From 8faa927628d5530c88285ac11f49700402bdce37 Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Fri, 10 Feb 2023 13:58:08 -0800 Subject: [PATCH 1/5] Generate on new swagger --- .../azure/storage/blob/_generated/__init__.py | 6 +- .../blob/_generated/_azure_blob_storage.py | 25 +- .../storage/blob/_generated/_configuration.py | 21 +- .../storage/blob/_generated/_serialization.py | 174 ++-- .../azure/storage/blob/_generated/_vendor.py | 5 +- .../storage/blob/_generated/aio/__init__.py | 6 +- .../_generated/aio/_azure_blob_storage.py | 18 +- .../blob/_generated/aio/_configuration.py | 16 +- .../_generated/aio/operations/__init__.py | 2 +- .../aio/operations/_append_blob_operations.py | 113 ++- .../aio/operations/_blob_operations.py | 722 ++++++++------ .../aio/operations/_block_blob_operations.py | 176 ++-- .../aio/operations/_container_operations.py | 671 +++++++------ .../aio/operations/_page_blob_operations.py | 263 ++--- .../aio/operations/_service_operations.py | 288 +++--- .../blob/_generated/models/__init__.py | 68 +- .../models/_azure_blob_storage_enums.py | 198 ++++ .../blob/_generated/models/_models_py3.py | 209 ++-- .../blob/_generated/operations/__init__.py | 2 +- .../operations/_append_blob_operations.py | 147 +-- .../_generated/operations/_blob_operations.py | 930 ++++++++++-------- .../operations/_block_blob_operations.py | 242 +++-- .../operations/_container_operations.py | 841 ++++++++-------- .../operations/_page_blob_operations.py | 341 ++++--- .../operations/_service_operations.py | 390 ++++---- 25 files changed, 3420 insertions(+), 2454 deletions(-) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/__init__.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/__init__.py index 2064cc374929..62dc43a7722a 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/__init__.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/__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__ = ["AzureBlobStorage"] +__all__ = [ + "AzureBlobStorage", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py index 1b841a23361b..0a498d5118d2 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py @@ -7,12 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any +from typing import Any, Union from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse -from . import models +from . import models as _models from ._configuration import AzureBlobStorageConfiguration from ._serialization import Deserializer, Serializer from .operations import ( @@ -43,20 +43,20 @@ class AzureBlobStorage: # pylint: disable=client-accepts-api-version-keyword :param url: The URL of the service account, container, or blob that is the target of the desired operation. Required. :type url: str + :param version: Specifies the version of the operation to use for this request. "2021-12-02" + Required. + :type version: str or ~azure.storage.blob.models.Enum2 :param base_url: Service URL. Required. Default value is "". :type base_url: str - :keyword version: Specifies the version of the operation to use for this request. Default value - is "2021-12-02". Note that overriding this default value may result in unsupported behavior. - :paramtype version: str """ def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, url: str, base_url: str = "", **kwargs: Any + self, url: str, version: Union[str, _models.Enum2], base_url: str = "", **kwargs: Any ) -> None: - self._config = AzureBlobStorageConfiguration(url=url, **kwargs) + self._config = AzureBlobStorageConfiguration(url=url, version=version, **kwargs) self._client = PipelineClient(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 @@ -89,15 +89,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: () -> AzureBlobStorage + def __enter__(self) -> "AzureBlobStorage": 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/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py index bde75f02cd57..0a71868ef3ff 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, Union from azure.core.configuration import Configuration from azure.core.pipeline import policies +from . import models as _models + VERSION = "unknown" @@ -23,27 +25,24 @@ class AzureBlobStorageConfiguration(Configuration): # pylint: disable=too-many- :param url: The URL of the service account, container, or blob that is the target of the desired operation. Required. :type url: str - :keyword version: Specifies the version of the operation to use for this request. Default value - is "2021-12-02". Note that overriding this default value may result in unsupported behavior. - :paramtype version: str + :param version: Specifies the version of the operation to use for this request. "2021-12-02" + Required. + :type version: str or ~azure.storage.blob.models.Enum2 """ - def __init__(self, url: str, **kwargs: Any) -> None: + def __init__(self, url: str, version: Union[str, _models.Enum2], **kwargs: Any) -> None: super(AzureBlobStorageConfiguration, self).__init__(**kwargs) - version = kwargs.pop("version", "2021-12-02") # type: str - if url is None: raise ValueError("Parameter 'url' must not be None.") + if version is None: + raise ValueError("Parameter 'version' must not be None.") self.url = url self.version = version kwargs.setdefault("sdk_moniker", "azureblobstorage/{}".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/storage/azure-storage-blob/azure/storage/blob/_generated/_serialization.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_serialization.py index 7c1dedb5133d..f17c068e833e 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_serialization.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_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 @@ -606,13 +630,13 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + 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,23 +645,22 @@ 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 @@ -659,8 +682,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 +698,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: @@ -780,6 +803,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 +868,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 @@ -1001,10 +1026,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 +1189,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 @@ -1335,7 +1361,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 +1381,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 +1442,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 +1470,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 +1500,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 +1515,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 +1525,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 +1569,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 +1591,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 +1773,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 +1824,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 +1836,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 +1852,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 +1867,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 +1897,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 +1912,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 +1927,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 +1950,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 +1986,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/storage/azure-storage-blob/azure/storage/blob/_generated/_vendor.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_vendor.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/__init__.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/__init__.py index 2064cc374929..62dc43a7722a 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/__init__.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/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__ = ["AzureBlobStorage"] +__all__ = [ + "AzureBlobStorage", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py index 8fbb8e5a4a11..20f2dfb8268c 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py @@ -7,12 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable +from typing import Any, Awaitable, Union from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest -from .. import models +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import AzureBlobStorageConfiguration from .operations import ( @@ -43,20 +43,20 @@ class AzureBlobStorage: # pylint: disable=client-accepts-api-version-keyword :param url: The URL of the service account, container, or blob that is the target of the desired operation. Required. :type url: str + :param version: Specifies the version of the operation to use for this request. "2021-12-02" + Required. + :type version: str or ~azure.storage.blob.models.Enum2 :param base_url: Service URL. Required. Default value is "". :type base_url: str - :keyword version: Specifies the version of the operation to use for this request. Default value - is "2021-12-02". Note that overriding this default value may result in unsupported behavior. - :paramtype version: str """ def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, url: str, base_url: str = "", **kwargs: Any + self, url: str, version: Union[str, _models.Enum2], base_url: str = "", **kwargs: Any ) -> None: - self._config = AzureBlobStorageConfiguration(url=url, **kwargs) + self._config = AzureBlobStorageConfiguration(url=url, version=version, **kwargs) self._client = AsyncPipelineClient(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 @@ -96,5 +96,5 @@ async def __aenter__(self) -> "AzureBlobStorage": 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/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py index 3ba2c071221a..978601f780b9 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, Union from azure.core.configuration import Configuration from azure.core.pipeline import policies +from .. import models as _models + VERSION = "unknown" @@ -23,17 +25,17 @@ class AzureBlobStorageConfiguration(Configuration): # pylint: disable=too-many- :param url: The URL of the service account, container, or blob that is the target of the desired operation. Required. :type url: str - :keyword version: Specifies the version of the operation to use for this request. Default value - is "2021-12-02". Note that overriding this default value may result in unsupported behavior. - :paramtype version: str + :param version: Specifies the version of the operation to use for this request. "2021-12-02" + Required. + :type version: str or ~azure.storage.blob.models.Enum2 """ - def __init__(self, url: str, **kwargs: Any) -> None: + def __init__(self, url: str, version: Union[str, _models.Enum2], **kwargs: Any) -> None: super(AzureBlobStorageConfiguration, self).__init__(**kwargs) - version = kwargs.pop("version", "2021-12-02") # type: str - if url is None: raise ValueError("Parameter 'url' must not be None.") + if version is None: + raise ValueError("Parameter 'version' must not be None.") self.url = url self.version = version diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/__init__.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/__init__.py index f8feb32687ac..1be05c7aa9a7 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/__init__.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/__init__.py @@ -14,7 +14,7 @@ from ._block_blob_operations import BlockBlobOperations 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__ = [ diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py index 734f15132967..c78cddabd04d 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py @@ -7,6 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -14,6 +15,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -31,6 +33,10 @@ build_seal_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +69,7 @@ async def create( # pylint: disable=inconsistent-return-statements request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, + immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, legal_hold: Optional[bool] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -123,14 +129,19 @@ async def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("params", {}) or {} - blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "AppendBlob")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + blob_type: Literal["AppendBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "AppendBlob")) + cls: ClsType[None] = kwargs.pop("cls", None) _blob_content_type = None _blob_content_encoding = None @@ -173,6 +184,7 @@ async def create( # pylint: disable=inconsistent-return-statements request = build_create_request( url=self._config.url, content_length=content_length, + version=self._config.version, timeout=timeout, blob_content_type=_blob_content_type, blob_content_encoding=_blob_content_encoding, @@ -197,15 +209,14 @@ async def create( # pylint: disable=inconsistent-return-statements immutability_policy_mode=immutability_policy_mode, legal_hold=legal_hold, blob_type=blob_type, - version=self._config.version, template_url=self.create.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -240,11 +251,12 @@ async def create( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + create.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def append_block( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum37], content_length: int, body: IO, timeout: Optional[int] = None, @@ -262,6 +274,8 @@ async def append_block( # pylint: disable=inconsistent-return-statements The Append Block operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. + :param comp: comp. "appendblock" Required. + :type comp: str or ~azure.storage.blob.models.Enum37 :param content_length: The length of the request. Required. :type content_length: int :param body: Initial data. Required. @@ -292,23 +306,24 @@ async def append_block( # pylint: disable=inconsistent-return-statements :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "appendblock". Note that overriding this default value - may result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "appendblock")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _max_size = None @@ -343,7 +358,9 @@ async def append_block( # pylint: disable=inconsistent-return-statements request = build_append_block_request( url=self._config.url, + comp=comp, content_length=content_length, + version=self._config.version, timeout=timeout, transactional_content_md5=transactional_content_md5, transactional_content_crc64=transactional_content_crc64, @@ -360,18 +377,16 @@ async def append_block( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, content_type=content_type, - version=self._config.version, content=_content, template_url=self.append_block.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -414,11 +429,12 @@ async def append_block( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - append_block.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + append_block.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def append_block_from_url( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum37], source_url: str, content_length: int, source_range: Optional[str] = None, @@ -441,6 +457,8 @@ async def append_block_from_url( # pylint: disable=inconsistent-return-statemen the blob was created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. + :param comp: comp. "appendblock" Required. + :type comp: str or ~azure.storage.blob.models.Enum37 :param source_url: Specify a URL to the copy source. Required. :type source_url: str :param content_length: The length of the request. Required. @@ -482,22 +500,23 @@ async def append_block_from_url( # pylint: disable=inconsistent-return-statemen :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions - :keyword comp: comp. Default value is "appendblock". Note that overriding this default value - may result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "appendblock")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _encryption_key = None _encryption_key_sha256 = None @@ -540,8 +559,10 @@ async def append_block_from_url( # pylint: disable=inconsistent-return-statemen request = build_append_block_from_url_request( url=self._config.url, + comp=comp, source_url=source_url, content_length=content_length, + version=self._config.version, source_range=source_range, source_content_md5=source_content_md5, source_contentcrc64=source_contentcrc64, @@ -565,16 +586,14 @@ async def append_block_from_url( # pylint: disable=inconsistent-return-statemen source_if_none_match=_source_if_none_match, request_id_parameter=request_id_parameter, copy_source_authorization=copy_source_authorization, - comp=comp, - version=self._config.version, template_url=self.append_block_from_url.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -614,11 +633,12 @@ async def append_block_from_url( # pylint: disable=inconsistent-return-statemen if cls: return cls(pipeline_response, None, response_headers) - append_block_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + append_block_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def seal( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum38], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -629,6 +649,8 @@ async def seal( # pylint: disable=inconsistent-return-statements """The Seal operation seals the Append Blob to make it read-only. Seal is supported only on version 2019-12-12 version or later. + :param comp: comp. "seal" Required. + :type comp: str or ~azure.storage.blob.models.Enum38 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -645,22 +667,23 @@ async def seal( # pylint: disable=inconsistent-return-statements :param append_position_access_conditions: Parameter group. Default value is None. :type append_position_access_conditions: ~azure.storage.blob.models.AppendPositionAccessConditions - :keyword comp: comp. Default value is "seal". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "seal")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _if_modified_since = None @@ -680,6 +703,8 @@ async def seal( # pylint: disable=inconsistent-return-statements request = build_seal_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, lease_id=_lease_id, @@ -688,16 +713,14 @@ async def seal( # pylint: disable=inconsistent-return-statements if_match=_if_match, if_none_match=_if_none_match, append_position=_append_position, - comp=comp, - version=self._config.version, template_url=self.seal.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -722,4 +745,4 @@ async def seal( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - seal.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + seal.metadata = {"url": "{url}/{containerName}/{blob}"} diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py index 2913e6ad887d..0a83eb399651 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py @@ -7,6 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime +import sys from typing import Any, AsyncIterator, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -14,6 +15,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -51,6 +53,10 @@ build_undelete_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -132,13 +138,18 @@ async def download( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[AsyncIterator[bytes]] + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _lease_id = None _encryption_key = None @@ -164,6 +175,7 @@ async def download( request = build_download_request( url=self._config.url, + version=self._config.version, snapshot=snapshot, version_id=version_id, timeout=timeout, @@ -180,15 +192,14 @@ async def download( if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - version=self._config.version, template_url=self.download.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=True, **kwargs ) @@ -202,6 +213,9 @@ async def download( response_headers = {} if response.status_code == 200: response_headers["Last-Modified"] = self._deserialize("rfc-1123", response.headers.get("Last-Modified")) + response_headers["x-ms-creation-time"] = self._deserialize( + "rfc-1123", response.headers.get("x-ms-creation-time") + ) response_headers["x-ms-meta"] = self._deserialize("{str}", response.headers.get("x-ms-meta")) response_headers["x-ms-or-policy-id"] = self._deserialize("str", response.headers.get("x-ms-or-policy-id")) response_headers["x-ms-or"] = self._deserialize("{str}", response.headers.get("x-ms-or")) @@ -280,6 +294,9 @@ async def download( if response.status_code == 206: response_headers["Last-Modified"] = self._deserialize("rfc-1123", response.headers.get("Last-Modified")) + response_headers["x-ms-creation-time"] = self._deserialize( + "rfc-1123", response.headers.get("x-ms-creation-time") + ) response_headers["x-ms-meta"] = self._deserialize("{str}", response.headers.get("x-ms-meta")) response_headers["x-ms-or-policy-id"] = self._deserialize("str", response.headers.get("x-ms-or-policy-id")) response_headers["x-ms-or"] = self._deserialize("{str}", response.headers.get("x-ms-or")) @@ -360,11 +377,11 @@ async def download( deserialized = response.stream_download(self._client._pipeline) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - download.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + download.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def get_properties( # pylint: disable=inconsistent-return-statements @@ -411,13 +428,18 @@ async def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _encryption_key = None @@ -443,6 +465,7 @@ async def get_properties( # pylint: disable=inconsistent-return-statements request = build_get_properties_request( url=self._config.url, + version=self._config.version, snapshot=snapshot, version_id=version_id, timeout=timeout, @@ -456,15 +479,14 @@ async def get_properties( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - version=self._config.version, template_url=self.get_properties.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -565,7 +587,7 @@ async def get_properties( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + get_properties.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -573,9 +595,9 @@ async def delete( # pylint: disable=inconsistent-return-statements snapshot: Optional[str] = None, version_id: Optional[str] = None, timeout: Optional[int] = None, - delete_snapshots: Optional[Union[str, "_models.DeleteSnapshotsOptionType"]] = None, + delete_snapshots: Optional[Union[str, _models.DeleteSnapshotsOptionType]] = None, request_id_parameter: Optional[str] = None, - blob_delete_type: str = "Permanent", + blob_delete_type: Literal["Permanent"] = "Permanent", lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, **kwargs: Any @@ -630,13 +652,18 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _if_modified_since = None @@ -655,6 +682,7 @@ async def delete( # pylint: disable=inconsistent-return-statements request = build_delete_request( url=self._config.url, + version=self._config.version, snapshot=snapshot, version_id=version_id, timeout=timeout, @@ -667,15 +695,14 @@ async def delete( # pylint: disable=inconsistent-return-statements if_tags=_if_tags, request_id_parameter=request_id_parameter, blob_delete_type=blob_delete_type, - version=self._config.version, template_url=self.delete.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -697,14 +724,20 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + delete.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def undelete( # pylint: disable=inconsistent-return-statements - self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + self, + comp: Union[str, _models.Enum14], + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + **kwargs: Any ) -> None: """Undelete a blob that was previously soft deleted. + :param comp: comp. "undelete" Required. + :type comp: str or ~azure.storage.blob.models.Enum14 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -714,37 +747,38 @@ async def undelete( # pylint: disable=inconsistent-return-statements limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword comp: comp. Default value is "undelete". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "undelete")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_undelete_request( url=self._config.url, - timeout=timeout, - request_id_parameter=request_id_parameter, comp=comp, version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, template_url=self.undelete.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -766,12 +800,13 @@ async def undelete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - undelete.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + undelete.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def set_expiry( # pylint: disable=inconsistent-return-statements self, - expiry_options: Union[str, "_models.BlobExpiryOptions"], + comp: Union[str, _models.Enum22], + expiry_options: Union[str, _models.BlobExpiryOptions], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, expires_on: Optional[str] = None, @@ -779,6 +814,8 @@ async def set_expiry( # pylint: disable=inconsistent-return-statements ) -> None: """Sets the time a blob will expire and be deleted. + :param comp: comp. "expiry" Required. + :type comp: str or ~azure.storage.blob.models.Enum22 :param expiry_options: Required. Indicates mode of the expiry time. Known values are: "NeverExpire", "RelativeToCreation", "RelativeToNow", and "Absolute". Required. :type expiry_options: str or ~azure.storage.blob.models.BlobExpiryOptions @@ -793,39 +830,40 @@ async def set_expiry( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param expires_on: The time to set the blob to expiry. Default value is None. :type expires_on: str - :keyword comp: comp. Default value is "expiry". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "expiry")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_set_expiry_request( url=self._config.url, + comp=comp, expiry_options=expiry_options, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, expires_on=expires_on, - comp=comp, - version=self._config.version, template_url=self.set_expiry.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -849,11 +887,12 @@ async def set_expiry( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_expiry.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + set_expiry.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def set_http_headers( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum1], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, @@ -863,6 +902,8 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements ) -> None: """The Set HTTP Headers operation sets system properties on the blob. + :param comp: comp. "properties" Required. + :type comp: str or ~azure.storage.blob.models.Enum1 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -878,22 +919,23 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "properties". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _blob_cache_control = None _blob_content_type = None @@ -925,6 +967,8 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements request = build_set_http_headers_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, blob_cache_control=_blob_cache_control, blob_content_type=_blob_content_type, @@ -939,16 +983,14 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements if_tags=_if_tags, blob_content_disposition=_blob_content_disposition, request_id_parameter=request_id_parameter, - comp=comp, - version=self._config.version, template_url=self.set_http_headers.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -975,20 +1017,23 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_http_headers.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + set_http_headers.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def set_immutability_policy( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum24], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, + immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, **kwargs: Any ) -> None: """The Set Immutability Policy operation sets the immutability policy on the blob. + :param comp: comp. "immutabilityPolicies" Required. + :type comp: str or ~azure.storage.blob.models.Enum24 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1006,22 +1051,23 @@ async def set_immutability_policy( # pylint: disable=inconsistent-return-statem :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "immutabilityPolicies". Note that overriding this default - value may result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _if_unmodified_since = None if modified_access_conditions is not None: @@ -1029,21 +1075,21 @@ async def set_immutability_policy( # pylint: disable=inconsistent-return-statem request = build_set_immutability_policy_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, if_unmodified_since=_if_unmodified_since, immutability_policy_expiry=immutability_policy_expiry, immutability_policy_mode=immutability_policy_mode, - comp=comp, - version=self._config.version, template_url=self.set_immutability_policy.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1071,14 +1117,20 @@ async def set_immutability_policy( # pylint: disable=inconsistent-return-statem if cls: return cls(pipeline_response, None, response_headers) - set_immutability_policy.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + set_immutability_policy.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def delete_immutability_policy( # pylint: disable=inconsistent-return-statements - self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + self, + comp: Union[str, _models.Enum24], + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + **kwargs: Any ) -> None: """The Delete Immutability Policy operation deletes the immutability policy on the blob. + :param comp: comp. "immutabilityPolicies" Required. + :type comp: str or ~azure.storage.blob.models.Enum24 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1088,37 +1140,38 @@ async def delete_immutability_policy( # pylint: disable=inconsistent-return-sta limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword comp: comp. Default value is "immutabilityPolicies". Note that overriding this default - value may result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_immutability_policy_request( url=self._config.url, - timeout=timeout, - request_id_parameter=request_id_parameter, comp=comp, version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, template_url=self.delete_immutability_policy.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1140,14 +1193,21 @@ async def delete_immutability_policy( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, response_headers) - delete_immutability_policy.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + delete_immutability_policy.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def set_legal_hold( # pylint: disable=inconsistent-return-statements - self, legal_hold: bool, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + self, + comp: Union[str, _models.Enum25], + legal_hold: bool, + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + **kwargs: Any ) -> None: """The Set Legal Hold operation sets a legal hold on the blob. + :param comp: comp. "legalhold" Required. + :type comp: str or ~azure.storage.blob.models.Enum25 :param legal_hold: Specified if a legal hold should be set on the blob. Required. :type legal_hold: bool :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -1159,38 +1219,39 @@ async def set_legal_hold( # pylint: disable=inconsistent-return-statements limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword comp: comp. Default value is "legalhold". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "legalhold")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_set_legal_hold_request( url=self._config.url, + comp=comp, legal_hold=legal_hold, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, - comp=comp, - version=self._config.version, template_url=self.set_legal_hold.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1213,11 +1274,12 @@ async def set_legal_hold( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_legal_hold.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + set_legal_hold.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def set_metadata( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum12], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, request_id_parameter: Optional[str] = None, @@ -1230,6 +1292,8 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements """The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-value pairs. + :param comp: comp. "metadata" Required. + :type comp: str or ~azure.storage.blob.models.Enum12 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1255,22 +1319,23 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "metadata". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "metadata")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _encryption_key = None @@ -1299,6 +1364,8 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements request = build_set_metadata_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, metadata=metadata, lease_id=_lease_id, @@ -1312,16 +1379,14 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, - version=self._config.version, template_url=self.set_metadata.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1355,11 +1420,12 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_metadata.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + set_metadata.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def acquire_lease( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum16], timeout: Optional[int] = None, duration: Optional[int] = None, proposed_lease_id: Optional[str] = None, @@ -1370,6 +1436,8 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements """[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + :param comp: comp. "lease" Required. + :type comp: str or ~azure.storage.blob.models.Enum16 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1389,9 +1457,6 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "lease". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword action: Describes what lease action to take. Default value is "acquire". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1400,15 +1465,19 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -1424,6 +1493,8 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements request = build_acquire_lease_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, duration=duration, proposed_lease_id=proposed_lease_id, @@ -1433,17 +1504,15 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, action=action, - version=self._config.version, template_url=self.acquire_lease.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1468,11 +1537,12 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - acquire_lease.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + acquire_lease.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def release_lease( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum16], lease_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -1482,6 +1552,8 @@ async def release_lease( # pylint: disable=inconsistent-return-statements """[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + :param comp: comp. "lease" Required. + :type comp: str or ~azure.storage.blob.models.Enum16 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -1495,9 +1567,6 @@ async def release_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "lease". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword action: Describes what lease action to take. Default value is "release". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1506,15 +1575,19 @@ async def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -1530,7 +1603,9 @@ async def release_lease( # pylint: disable=inconsistent-return-statements request = build_release_lease_request( url=self._config.url, + comp=comp, lease_id=lease_id, + version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, @@ -1538,17 +1613,15 @@ async def release_lease( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, action=action, - version=self._config.version, template_url=self.release_lease.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1572,11 +1645,12 @@ async def release_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - release_lease.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + release_lease.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def renew_lease( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum16], lease_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -1586,6 +1660,8 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements """[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + :param comp: comp. "lease" Required. + :type comp: str or ~azure.storage.blob.models.Enum16 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -1599,9 +1675,6 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "lease". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword action: Describes what lease action to take. Default value is "renew". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1610,15 +1683,19 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -1634,7 +1711,9 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements request = build_renew_lease_request( url=self._config.url, + comp=comp, lease_id=lease_id, + version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, @@ -1642,17 +1721,15 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, action=action, - version=self._config.version, template_url=self.renew_lease.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1677,11 +1754,12 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - renew_lease.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + renew_lease.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def change_lease( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum16], lease_id: str, proposed_lease_id: str, timeout: Optional[int] = None, @@ -1692,6 +1770,8 @@ async def change_lease( # pylint: disable=inconsistent-return-statements """[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + :param comp: comp. "lease" Required. + :type comp: str or ~azure.storage.blob.models.Enum16 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param proposed_lease_id: Proposed lease ID, in a GUID string format. The Blob service returns @@ -1709,9 +1789,6 @@ async def change_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "lease". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword action: Describes what lease action to take. Default value is "change". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1720,15 +1797,19 @@ async def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -1744,8 +1825,10 @@ async def change_lease( # pylint: disable=inconsistent-return-statements request = build_change_lease_request( url=self._config.url, + comp=comp, lease_id=lease_id, proposed_lease_id=proposed_lease_id, + version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, @@ -1753,17 +1836,15 @@ async def change_lease( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, action=action, - version=self._config.version, template_url=self.change_lease.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1788,11 +1869,12 @@ async def change_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - change_lease.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + change_lease.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def break_lease( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum16], timeout: Optional[int] = None, break_period: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -1802,6 +1884,8 @@ async def break_lease( # pylint: disable=inconsistent-return-statements """[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + :param comp: comp. "lease" Required. + :type comp: str or ~azure.storage.blob.models.Enum16 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1821,9 +1905,6 @@ async def break_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "lease". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword action: Describes what lease action to take. Default value is "break". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1832,15 +1913,19 @@ async def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -1856,6 +1941,8 @@ async def break_lease( # pylint: disable=inconsistent-return-statements request = build_break_lease_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, break_period=break_period, if_modified_since=_if_modified_since, @@ -1864,17 +1951,15 @@ async def break_lease( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, action=action, - version=self._config.version, template_url=self.break_lease.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1899,11 +1984,12 @@ async def break_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - break_lease.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + break_lease.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def create_snapshot( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum26], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, request_id_parameter: Optional[str] = None, @@ -1915,6 +2001,8 @@ async def create_snapshot( # pylint: disable=inconsistent-return-statements ) -> None: """The Create Snapshot operation creates a read-only snapshot of a blob. + :param comp: comp. "snapshot" Required. + :type comp: str or ~azure.storage.blob.models.Enum26 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1940,22 +2028,23 @@ async def create_snapshot( # pylint: disable=inconsistent-return-statements :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword comp: comp. Default value is "snapshot". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "snapshot")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _encryption_key = None _encryption_key_sha256 = None @@ -1984,6 +2073,8 @@ async def create_snapshot( # pylint: disable=inconsistent-return-statements request = build_create_snapshot_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, metadata=metadata, encryption_key=_encryption_key, @@ -1997,16 +2088,14 @@ async def create_snapshot( # pylint: disable=inconsistent-return-statements if_tags=_if_tags, lease_id=_lease_id, request_id_parameter=request_id_parameter, - comp=comp, - version=self._config.version, template_url=self.create_snapshot.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2035,7 +2124,7 @@ async def create_snapshot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - create_snapshot.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + create_snapshot.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def start_copy_from_url( # pylint: disable=inconsistent-return-statements @@ -2043,13 +2132,13 @@ async def start_copy_from_url( # pylint: disable=inconsistent-return-statements copy_source: str, timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, - rehydrate_priority: Optional[Union[str, "_models.RehydratePriority"]] = None, + tier: Optional[Union[str, _models.AccessTierOptional]] = None, + rehydrate_priority: Optional[Union[str, _models.RehydratePriority]] = None, request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, seal_blob: Optional[bool] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, + immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, legal_hold: Optional[bool] = None, source_modified_access_conditions: Optional[_models.SourceModifiedAccessConditions] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, @@ -2113,13 +2202,18 @@ async def start_copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _source_if_modified_since = None _source_if_unmodified_since = None @@ -2150,6 +2244,7 @@ async def start_copy_from_url( # pylint: disable=inconsistent-return-statements request = build_start_copy_from_url_request( url=self._config.url, copy_source=copy_source, + version=self._config.version, timeout=timeout, metadata=metadata, tier=tier, @@ -2171,15 +2266,14 @@ async def start_copy_from_url( # pylint: disable=inconsistent-return-statements immutability_policy_expiry=immutability_policy_expiry, immutability_policy_mode=immutability_policy_mode, legal_hold=legal_hold, - version=self._config.version, template_url=self.start_copy_from_url.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2206,23 +2300,24 @@ async def start_copy_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - start_copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + start_copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def copy_from_url( # pylint: disable=inconsistent-return-statements self, + x_ms_requires_sync: Union[str, _models.Enum27], copy_source: str, timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, + tier: Optional[Union[str, _models.AccessTierOptional]] = None, request_id_parameter: Optional[str] = None, source_content_md5: Optional[bytes] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, + immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, legal_hold: Optional[bool] = None, copy_source_authorization: Optional[str] = None, - copy_source_tags: Optional[Union[str, "_models.BlobCopySourceTags"]] = None, + copy_source_tags: Optional[Union[str, _models.BlobCopySourceTags]] = None, source_modified_access_conditions: Optional[_models.SourceModifiedAccessConditions] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -2232,6 +2327,9 @@ async def copy_from_url( # pylint: disable=inconsistent-return-statements """The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response until the copy is complete. + :param x_ms_requires_sync: This header indicates that this is a synchronous Copy Blob From URL + instead of a Asynchronous Copy Blob. "true" Required. + :type x_ms_requires_sync: str or ~azure.storage.blob.models.Enum27 :param copy_source: Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated @@ -2288,23 +2386,23 @@ async def copy_from_url( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :keyword x_ms_requires_sync: This header indicates that this is a synchronous Copy Blob From - URL instead of a Asynchronous Copy Blob. Default value is "true". Note that overriding this - default value may result in unsupported behavior. - :paramtype x_ms_requires_sync: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - x_ms_requires_sync = kwargs.pop("x_ms_requires_sync", _headers.pop("x-ms-requires-sync", "true")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _source_if_modified_since = None _source_if_unmodified_since = None @@ -2335,7 +2433,9 @@ async def copy_from_url( # pylint: disable=inconsistent-return-statements request = build_copy_from_url_request( url=self._config.url, + x_ms_requires_sync=x_ms_requires_sync, copy_source=copy_source, + version=self._config.version, timeout=timeout, metadata=metadata, tier=tier, @@ -2358,16 +2458,14 @@ async def copy_from_url( # pylint: disable=inconsistent-return-statements copy_source_authorization=copy_source_authorization, encryption_scope=_encryption_scope, copy_source_tags=copy_source_tags, - x_ms_requires_sync=x_ms_requires_sync, - version=self._config.version, template_url=self.copy_from_url.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2401,11 +2499,13 @@ async def copy_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def abort_copy_from_url( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum28], + copy_action_abort_constant: Union[str, _models.Enum29], copy_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -2415,6 +2515,10 @@ async def abort_copy_from_url( # pylint: disable=inconsistent-return-statements """The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with zero length and full metadata. + :param comp: comp. "copy" Required. + :type comp: str or ~azure.storage.blob.models.Enum28 + :param copy_action_abort_constant: Copy action. "abort" Required. + :type copy_action_abort_constant: str or ~azure.storage.blob.models.Enum29 :param copy_id: The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. Required. :type copy_id: str @@ -2429,28 +2533,23 @@ async def abort_copy_from_url( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword comp: comp. Default value is "copy". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str - :keyword copy_action_abort_constant: Copy action. Default value is "abort". Note that - overriding this default value may result in unsupported behavior. - :paramtype copy_action_abort_constant: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "copy")) # type: str - copy_action_abort_constant = kwargs.pop( - "copy_action_abort_constant", _headers.pop("x-ms-copy-action", "abort") - ) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None if lease_access_conditions is not None: @@ -2458,21 +2557,21 @@ async def abort_copy_from_url( # pylint: disable=inconsistent-return-statements request = build_abort_copy_from_url_request( url=self._config.url, + comp=comp, + copy_action_abort_constant=copy_action_abort_constant, copy_id=copy_id, + version=self._config.version, timeout=timeout, lease_id=_lease_id, request_id_parameter=request_id_parameter, - comp=comp, - copy_action_abort_constant=copy_action_abort_constant, - version=self._config.version, template_url=self.abort_copy_from_url.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2494,16 +2593,17 @@ async def abort_copy_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - abort_copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + abort_copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def set_tier( # pylint: disable=inconsistent-return-statements self, - tier: Union[str, "_models.AccessTierRequired"], + comp: Union[str, _models.Enum30], + tier: Union[str, _models.AccessTierRequired], snapshot: Optional[str] = None, version_id: Optional[str] = None, timeout: Optional[int] = None, - rehydrate_priority: Optional[Union[str, "_models.RehydratePriority"]] = None, + rehydrate_priority: Optional[Union[str, _models.RehydratePriority]] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, @@ -2515,6 +2615,8 @@ async def set_tier( # pylint: disable=inconsistent-return-statements the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag. + :param comp: comp. "tier" Required. + :type comp: str or ~azure.storage.blob.models.Enum30 :param tier: Indicates the tier to be set on the blob. Known values are: "P4", "P6", "P10", "P15", "P20", "P30", "P40", "P50", "P60", "P70", "P80", "Hot", "Cool", "Archive", and "Cold". Required. @@ -2545,22 +2647,23 @@ async def set_tier( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "tier". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "tier")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _if_tags = None @@ -2571,7 +2674,9 @@ async def set_tier( # pylint: disable=inconsistent-return-statements request = build_set_tier_request( url=self._config.url, + comp=comp, tier=tier, + version=self._config.version, snapshot=snapshot, version_id=version_id, timeout=timeout, @@ -2579,16 +2684,14 @@ async def set_tier( # pylint: disable=inconsistent-return-statements request_id_parameter=request_id_parameter, lease_id=_lease_id, if_tags=_if_tags, - comp=comp, - version=self._config.version, template_url=self.set_tier.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2617,32 +2720,35 @@ async def set_tier( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_tier.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + set_tier.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async - async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + async def get_account_info( # pylint: disable=inconsistent-return-statements + self, restype: Union[str, _models.Enum8], comp: Union[str, _models.Enum1], **kwargs: Any + ) -> None: """Returns the sku name and account kind. - :keyword restype: restype. Default value is "account". Note that overriding this default value - may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "properties". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str + :param restype: restype. "account" Required. + :type restype: str or ~azure.storage.blob.models.Enum8 + :param comp: comp. "properties" Required. + :type comp: str or ~azure.storage.blob.models.Enum1 :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "account")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_get_account_info_request( url=self._config.url, @@ -2654,9 +2760,9 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2680,11 +2786,12 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco if cls: return cls(pipeline_response, None, response_headers) - get_account_info.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + get_account_info.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def query( self, + comp: Union[str, _models.Enum39], snapshot: Optional[str] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -2697,6 +2804,8 @@ async def query( """The Query operation enables users to select/project on blob data by providing simple query expressions. + :param comp: comp. "query" Required. + :type comp: str or ~azure.storage.blob.models.Enum39 :param snapshot: The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:` _models.BlobTags: """The Get Tags operation enables users to get the tags associated with a blob. + :param comp: comp. "tags" Required. + :type comp: str or ~azure.storage.blob.models.Enum41 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -2967,22 +3080,23 @@ async def get_tags( :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword comp: comp. Default value is "tags". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: BlobTags or the result of cls(response) :rtype: ~azure.storage.blob.models.BlobTags :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "tags")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BlobTags] + cls: ClsType[_models.BlobTags] = kwargs.pop("cls", None) _if_tags = None _lease_id = None @@ -2993,22 +3107,22 @@ async def get_tags( request = build_get_tags_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, snapshot=snapshot, version_id=version_id, if_tags=_if_tags, lease_id=_lease_id, - comp=comp, - version=self._config.version, template_url=self.get_tags.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3034,11 +3148,12 @@ async def get_tags( return deserialized - get_tags.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + get_tags.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def set_tags( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum41], timeout: Optional[int] = None, version_id: Optional[str] = None, transactional_content_md5: Optional[bytes] = None, @@ -3051,6 +3166,8 @@ async def set_tags( # pylint: disable=inconsistent-return-statements ) -> None: """The Set Tags operation enables users to set tags on a blob. + :param comp: comp. "tags" Required. + :type comp: str or ~azure.storage.blob.models.Enum41 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -3076,23 +3193,24 @@ async def set_tags( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param tags: Blob tags. Default value is None. :type tags: ~azure.storage.blob.models.BlobTags - :keyword comp: comp. Default value is "tags". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "tags")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_tags = None _lease_id = None @@ -3107,6 +3225,8 @@ async def set_tags( # pylint: disable=inconsistent-return-statements request = build_set_tags_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, version_id=version_id, transactional_content_md5=transactional_content_md5, @@ -3114,18 +3234,16 @@ async def set_tags( # pylint: disable=inconsistent-return-statements request_id_parameter=request_id_parameter, if_tags=_if_tags, lease_id=_lease_id, - comp=comp, content_type=content_type, - version=self._config.version, content=_content, template_url=self.set_tags.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3147,4 +3265,4 @@ async def set_tags( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_tags.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + set_tags.metadata = {"url": "{url}/{containerName}/{blob}"} diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py index b3ac51917d51..aef273987071 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py @@ -7,6 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -14,6 +15,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -33,6 +35,10 @@ build_upload_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,11 +70,11 @@ async def upload( # pylint: disable=inconsistent-return-statements timeout: Optional[int] = None, transactional_content_md5: Optional[bytes] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, + tier: Optional[Union[str, _models.AccessTierOptional]] = None, request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, + immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, legal_hold: Optional[bool] = None, transactional_content_crc64: Optional[bytes] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, @@ -145,15 +151,20 @@ async def upload( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("params", {}) or {} - blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + blob_type: Literal["BlockBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + cls: ClsType[None] = kwargs.pop("cls", None) _blob_content_type = None _blob_content_encoding = None @@ -197,6 +208,7 @@ async def upload( # pylint: disable=inconsistent-return-statements request = build_upload_request( url=self._config.url, content_length=content_length, + version=self._config.version, timeout=timeout, transactional_content_md5=transactional_content_md5, blob_content_type=_blob_content_type, @@ -225,16 +237,15 @@ async def upload( # pylint: disable=inconsistent-return-statements transactional_content_crc64=transactional_content_crc64, blob_type=blob_type, content_type=content_type, - version=self._config.version, content=_content, template_url=self.upload.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -269,7 +280,7 @@ async def upload( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - upload.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + upload.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def put_blob_from_url( # pylint: disable=inconsistent-return-statements @@ -279,13 +290,13 @@ async def put_blob_from_url( # pylint: disable=inconsistent-return-statements timeout: Optional[int] = None, transactional_content_md5: Optional[bytes] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, + tier: Optional[Union[str, _models.AccessTierOptional]] = None, request_id_parameter: Optional[str] = None, source_content_md5: Optional[bytes] = None, blob_tags_string: Optional[str] = None, copy_source_blob_properties: Optional[bool] = None, copy_source_authorization: Optional[str] = None, - copy_source_tags: Optional[Union[str, "_models.BlobCopySourceTags"]] = None, + copy_source_tags: Optional[Union[str, _models.BlobCopySourceTags]] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, cpk_info: Optional[_models.CpkInfo] = None, @@ -369,14 +380,19 @@ async def put_blob_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("params", {}) or {} - blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + blob_type: Literal["BlockBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) + cls: ClsType[None] = kwargs.pop("cls", None) _blob_content_type = None _blob_content_encoding = None @@ -431,6 +447,7 @@ async def put_blob_from_url( # pylint: disable=inconsistent-return-statements url=self._config.url, content_length=content_length, copy_source=copy_source, + version=self._config.version, timeout=timeout, transactional_content_md5=transactional_content_md5, blob_content_type=_blob_content_type, @@ -463,15 +480,14 @@ async def put_blob_from_url( # pylint: disable=inconsistent-return-statements copy_source_authorization=copy_source_authorization, copy_source_tags=copy_source_tags, blob_type=blob_type, - version=self._config.version, template_url=self.put_blob_from_url.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -506,11 +522,12 @@ async def put_blob_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - put_blob_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + put_blob_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def stage_block( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum32], block_id: str, content_length: int, body: IO, @@ -525,6 +542,8 @@ async def stage_block( # pylint: disable=inconsistent-return-statements ) -> None: """The Stage Block operation creates a new block to be committed as part of a blob. + :param comp: comp. "block" Required. + :type comp: str or ~azure.storage.blob.models.Enum32 :param block_id: A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the same size for each block. Required. @@ -554,23 +573,24 @@ async def stage_block( # pylint: disable=inconsistent-return-statements :type cpk_info: ~azure.storage.blob.models.CpkInfo :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :keyword comp: comp. Default value is "block". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "block")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _encryption_key = None @@ -589,8 +609,10 @@ async def stage_block( # pylint: disable=inconsistent-return-statements request = build_stage_block_request( url=self._config.url, + comp=comp, block_id=block_id, content_length=content_length, + version=self._config.version, transactional_content_md5=transactional_content_md5, transactional_content_crc64=transactional_content_crc64, timeout=timeout, @@ -600,18 +622,16 @@ async def stage_block( # pylint: disable=inconsistent-return-statements encryption_algorithm=_encryption_algorithm, encryption_scope=_encryption_scope, request_id_parameter=request_id_parameter, - comp=comp, content_type=content_type, - version=self._config.version, content=_content, template_url=self.stage_block.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -646,11 +666,12 @@ async def stage_block( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - stage_block.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + stage_block.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def stage_block_from_url( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum32], block_id: str, content_length: int, source_url: str, @@ -669,6 +690,8 @@ async def stage_block_from_url( # pylint: disable=inconsistent-return-statement """The Stage Block operation creates a new block to be committed as part of a blob where the contents are read from a URL. + :param comp: comp. "block" Required. + :type comp: str or ~azure.storage.blob.models.Enum32 :param block_id: A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the same size for each block. Required. @@ -706,22 +729,23 @@ async def stage_block_from_url( # pylint: disable=inconsistent-return-statement :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions - :keyword comp: comp. Default value is "block". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "block")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _encryption_key = None _encryption_key_sha256 = None @@ -748,9 +772,11 @@ async def stage_block_from_url( # pylint: disable=inconsistent-return-statement request = build_stage_block_from_url_request( url=self._config.url, + comp=comp, block_id=block_id, content_length=content_length, source_url=source_url, + version=self._config.version, source_range=source_range, source_content_md5=source_content_md5, source_contentcrc64=source_contentcrc64, @@ -766,16 +792,14 @@ async def stage_block_from_url( # pylint: disable=inconsistent-return-statement source_if_none_match=_source_if_none_match, request_id_parameter=request_id_parameter, copy_source_authorization=copy_source_authorization, - comp=comp, - version=self._config.version, template_url=self.stage_block_from_url.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -810,21 +834,22 @@ async def stage_block_from_url( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, response_headers) - stage_block_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + stage_block_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def commit_block_list( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum33], blocks: _models.BlockLookupList, timeout: Optional[int] = None, transactional_content_md5: Optional[bytes] = None, transactional_content_crc64: Optional[bytes] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, + tier: Optional[Union[str, _models.AccessTierOptional]] = None, request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, + immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, legal_hold: Optional[bool] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -841,6 +866,8 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements or from the uncommitted block list, or to commit the most recently uploaded version of the block, whichever list it may belong to. + :param comp: comp. "blocklist" Required. + :type comp: str or ~azure.storage.blob.models.Enum33 :param blocks: Blob Blocks. Required. :type blocks: ~azure.storage.blob.models.BlockLookupList :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -891,23 +918,24 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "blocklist". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "blocklist")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) _blob_cache_control = None _blob_content_type = None @@ -950,6 +978,8 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements request = build_commit_block_list_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, blob_cache_control=_blob_cache_control, blob_content_type=_blob_content_type, @@ -976,18 +1006,16 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements immutability_policy_expiry=immutability_policy_expiry, immutability_policy_mode=immutability_policy_mode, legal_hold=legal_hold, - comp=comp, content_type=content_type, - version=self._config.version, content=_content, template_url=self.commit_block_list.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1025,13 +1053,14 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - commit_block_list.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + commit_block_list.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def get_block_list( self, + comp: Union[str, _models.Enum33], snapshot: Optional[str] = None, - list_type: Union[str, "_models.BlockListType"] = "committed", + list_type: Union[str, _models.BlockListType] = "committed", timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -1041,6 +1070,8 @@ async def get_block_list( """The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob. + :param comp: comp. "blocklist" Required. + :type comp: str or ~azure.storage.blob.models.Enum33 :param snapshot: The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:`= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,9 +76,10 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace_async async def create( # pylint: disable=inconsistent-return-statements self, + restype: Union[str, _models.Enum11], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, - access: Optional[Union[str, "_models.PublicAccessType"]] = None, + access: Optional[Union[str, _models.PublicAccessType]] = None, request_id_parameter: Optional[str] = None, container_cpk_scope_info: Optional[_models.ContainerCpkScopeInfo] = None, **kwargs: Any @@ -80,6 +87,8 @@ async def create( # pylint: disable=inconsistent-return-statements """creates a new container under the specified account. If the container with the same name already exists, the operation fails. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -102,22 +111,23 @@ async def create( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param container_cpk_scope_info: Parameter group. Default value is None. :type container_cpk_scope_info: ~azure.storage.blob.models.ContainerCpkScopeInfo - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _default_encryption_scope = None _prevent_encryption_scope_override = None @@ -127,22 +137,22 @@ async def create( # pylint: disable=inconsistent-return-statements request = build_create_request( url=self._config.url, + restype=restype, + version=self._config.version, timeout=timeout, metadata=metadata, access=access, request_id_parameter=request_id_parameter, default_encryption_scope=_default_encryption_scope, prevent_encryption_scope_override=_prevent_encryption_scope_override, - restype=restype, - version=self._config.version, template_url=self.create.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -166,11 +176,12 @@ async def create( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {"url": "{url}/{containerName}"} # type: ignore + create.metadata = {"url": "{url}/{containerName}"} @distributed_trace_async async def get_properties( # pylint: disable=inconsistent-return-statements self, + restype: Union[str, _models.Enum11], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -179,6 +190,8 @@ async def get_properties( # pylint: disable=inconsistent-return-statements """returns all user-defined metadata and system properties for the specified container. The data returned does not include the container's list of blobs. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -190,22 +203,23 @@ async def get_properties( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None if lease_access_conditions is not None: @@ -213,19 +227,19 @@ async def get_properties( # pylint: disable=inconsistent-return-statements request = build_get_properties_request( url=self._config.url, + restype=restype, + version=self._config.version, timeout=timeout, lease_id=_lease_id, request_id_parameter=request_id_parameter, - restype=restype, - version=self._config.version, template_url=self.get_properties.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -269,11 +283,12 @@ async def get_properties( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {"url": "{url}/{containerName}"} # type: ignore + get_properties.metadata = {"url": "{url}/{containerName}"} @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, + restype: Union[str, _models.Enum11], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -283,6 +298,8 @@ async def delete( # pylint: disable=inconsistent-return-statements """operation marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -296,22 +313,23 @@ async def delete( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _if_modified_since = None @@ -324,21 +342,21 @@ async def delete( # pylint: disable=inconsistent-return-statements request = build_delete_request( url=self._config.url, + restype=restype, + version=self._config.version, timeout=timeout, lease_id=_lease_id, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, - restype=restype, - version=self._config.version, template_url=self.delete.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -360,11 +378,13 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {"url": "{url}/{containerName}"} # type: ignore + delete.metadata = {"url": "{url}/{containerName}"} @distributed_trace_async async def set_metadata( # pylint: disable=inconsistent-return-statements self, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum12], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, request_id_parameter: Optional[str] = None, @@ -374,6 +394,10 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements ) -> None: """operation sets one or more user-defined name-value pairs for the specified container. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 + :param comp: comp. "metadata" Required. + :type comp: str or ~azure.storage.blob.models.Enum12 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -395,26 +419,23 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "metadata". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "metadata")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _if_modified_since = None @@ -425,22 +446,22 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements request = build_set_metadata_request( url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, timeout=timeout, lease_id=_lease_id, metadata=metadata, if_modified_since=_if_modified_since, request_id_parameter=request_id_parameter, - restype=restype, - comp=comp, - version=self._config.version, template_url=self.set_metadata.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -464,11 +485,13 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_metadata.metadata = {"url": "{url}/{containerName}"} # type: ignore + set_metadata.metadata = {"url": "{url}/{containerName}"} @distributed_trace_async async def get_access_policy( self, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum13], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -477,6 +500,10 @@ async def get_access_policy( """gets the permissions for the specified container. The permissions indicate whether container data may be accessed publicly. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 + :param comp: comp. "acl" Required. + :type comp: str or ~azure.storage.blob.models.Enum13 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -488,26 +515,23 @@ async def get_access_policy( :type request_id_parameter: str :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "acl". Note that overriding this default value may result - in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of SignedIdentifier or the result of cls(response) :rtype: list[~azure.storage.blob.models.SignedIdentifier] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "acl")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.SignedIdentifier]] + cls: ClsType[List[_models.SignedIdentifier]] = kwargs.pop("cls", None) _lease_id = None if lease_access_conditions is not None: @@ -515,20 +539,20 @@ async def get_access_policy( request = build_get_access_policy_request( url=self._config.url, - timeout=timeout, - lease_id=_lease_id, - request_id_parameter=request_id_parameter, restype=restype, comp=comp, version=self._config.version, + timeout=timeout, + lease_id=_lease_id, + request_id_parameter=request_id_parameter, template_url=self.get_access_policy.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -559,13 +583,15 @@ async def get_access_policy( return deserialized - get_access_policy.metadata = {"url": "{url}/{containerName}"} # type: ignore + get_access_policy.metadata = {"url": "{url}/{containerName}"} @distributed_trace_async async def set_access_policy( # pylint: disable=inconsistent-return-statements self, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum13], timeout: Optional[int] = None, - access: Optional[Union[str, "_models.PublicAccessType"]] = None, + access: Optional[Union[str, _models.PublicAccessType]] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, @@ -575,6 +601,10 @@ async def set_access_policy( # pylint: disable=inconsistent-return-statements """sets the permissions for the specified container. The permissions indicate whether blobs in a container may be accessed publicly. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 + :param comp: comp. "acl" Required. + :type comp: str or ~azure.storage.blob.models.Enum13 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -593,27 +623,24 @@ async def set_access_policy( # pylint: disable=inconsistent-return-statements :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param container_acl: the acls for the container. Default value is None. :type container_acl: list[~azure.storage.blob.models.SignedIdentifier] - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "acl". Note that overriding this default value may result - in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "acl")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _if_modified_since = None @@ -633,25 +660,25 @@ async def set_access_policy( # pylint: disable=inconsistent-return-statements request = build_set_access_policy_request( url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, timeout=timeout, lease_id=_lease_id, access=access, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, - restype=restype, - comp=comp, content_type=content_type, - version=self._config.version, content=_content, template_url=self.set_access_policy.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -675,11 +702,13 @@ async def set_access_policy( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_access_policy.metadata = {"url": "{url}/{containerName}"} # type: ignore + set_access_policy.metadata = {"url": "{url}/{containerName}"} @distributed_trace_async async def restore( # pylint: disable=inconsistent-return-statements self, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum14], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, deleted_container_name: Optional[str] = None, @@ -688,6 +717,10 @@ async def restore( # pylint: disable=inconsistent-return-statements ) -> None: """Restores a previously-deleted container. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 + :param comp: comp. "undelete" Required. + :type comp: str or ~azure.storage.blob.models.Enum14 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -703,44 +736,41 @@ async def restore( # pylint: disable=inconsistent-return-statements :param deleted_container_version: Optional. Version 2019-12-12 and later. Specifies the version of the deleted container to restore. Default value is None. :type deleted_container_version: str - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "undelete". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "undelete")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_restore_request( url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, deleted_container_name=deleted_container_name, deleted_container_version=deleted_container_version, - restype=restype, - comp=comp, - version=self._config.version, template_url=self.restore.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -762,11 +792,13 @@ async def restore( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - restore.metadata = {"url": "{url}/{containerName}"} # type: ignore + restore.metadata = {"url": "{url}/{containerName}"} @distributed_trace_async async def rename( # pylint: disable=inconsistent-return-statements self, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum15], source_container_name: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -775,6 +807,10 @@ async def rename( # pylint: disable=inconsistent-return-statements ) -> None: """Renames an existing container. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 + :param comp: comp. "rename" Required. + :type comp: str or ~azure.storage.blob.models.Enum15 :param source_container_name: Required. Specifies the name of the container to rename. Required. :type source_container_name: str @@ -790,44 +826,41 @@ async def rename( # pylint: disable=inconsistent-return-statements :param source_lease_id: A lease ID for the source path. If specified, the source path must have an active lease and the lease ID must match. Default value is None. :type source_lease_id: str - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "rename". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "rename")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_rename_request( url=self._config.url, + restype=restype, + comp=comp, source_container_name=source_container_name, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, source_lease_id=source_lease_id, - restype=restype, - comp=comp, - version=self._config.version, template_url=self.rename.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -849,11 +882,13 @@ async def rename( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - rename.metadata = {"url": "{url}/{containerName}"} # type: ignore + rename.metadata = {"url": "{url}/{containerName}"} @distributed_trace_async async def submit_batch( self, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum9], content_length: int, body: IO, timeout: Optional[int] = None, @@ -862,6 +897,10 @@ async def submit_batch( ) -> AsyncIterator[bytes]: """The Batch operation allows multiple API calls to be embedded into a single HTTP request. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 + :param comp: comp. "batch" Required. + :type comp: str or ~azure.storage.blob.models.Enum9 :param content_length: The length of the request. Required. :type content_length: int :param body: Initial data. Required. @@ -875,50 +914,47 @@ async def submit_batch( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "batch". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Async iterator of the response bytes or the result of cls(response) :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "batch")) # type: str - multipart_content_type = kwargs.pop( + multipart_content_type: str = kwargs.pop( "multipart_content_type", _headers.pop("Content-Type", "application/xml") - ) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[AsyncIterator[bytes]] + ) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _content = body request = build_submit_batch_request( url=self._config.url, + restype=restype, + comp=comp, content_length=content_length, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, - restype=restype, - comp=comp, multipart_content_type=multipart_content_type, - version=self._config.version, content=_content, template_url=self.submit_batch.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=True, **kwargs ) @@ -937,26 +973,32 @@ async def submit_batch( deserialized = response.stream_download(self._client._pipeline) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - submit_batch.metadata = {"url": "{url}/{containerName}"} # type: ignore + submit_batch.metadata = {"url": "{url}/{containerName}"} @distributed_trace_async async def filter_blobs( self, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum10], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, where: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, "_models.FilterBlobsIncludeItem"]]] = None, + include: Optional[List[Union[str, _models.FilterBlobsIncludeItem]]] = None, **kwargs: Any ) -> _models.FilterBlobSegment: """The Filter Blobs operation enables callers to list blobs in a container whose tags match a given search expression. Filter blobs searches within the given container. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 + :param comp: comp. "blobs" Required. + :type comp: str or ~azure.storage.blob.models.Enum10 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -986,46 +1028,43 @@ async def filter_blobs( :param include: Include this parameter to specify one or more datasets to include in the response. Default value is None. :type include: list[str or ~azure.storage.blob.models.FilterBlobsIncludeItem] - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "blobs". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FilterBlobSegment or the result of cls(response) :rtype: ~azure.storage.blob.models.FilterBlobSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "blobs")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.FilterBlobSegment] + cls: ClsType[_models.FilterBlobSegment] = kwargs.pop("cls", None) request = build_filter_blobs_request( url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, where=where, marker=marker, maxresults=maxresults, include=include, - restype=restype, - comp=comp, - version=self._config.version, template_url=self.filter_blobs.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1051,11 +1090,13 @@ async def filter_blobs( return deserialized - filter_blobs.metadata = {"url": "{url}/{containerName}"} # type: ignore + filter_blobs.metadata = {"url": "{url}/{containerName}"} @distributed_trace_async async def acquire_lease( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum16], + restype: Union[str, _models.Enum11], timeout: Optional[int] = None, duration: Optional[int] = None, proposed_lease_id: Optional[str] = None, @@ -1066,6 +1107,10 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements """[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + :param comp: comp. "lease" Required. + :type comp: str or ~azure.storage.blob.models.Enum16 + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1085,12 +1130,6 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "lease". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str :keyword action: Describes what lease action to take. Default value is "acquire". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1099,16 +1138,19 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -1118,24 +1160,24 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements request = build_acquire_lease_request( url=self._config.url, + comp=comp, + restype=restype, + version=self._config.version, timeout=timeout, duration=duration, proposed_lease_id=proposed_lease_id, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, - comp=comp, - restype=restype, action=action, - version=self._config.version, template_url=self.acquire_lease.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1160,11 +1202,13 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - acquire_lease.metadata = {"url": "{url}/{containerName}"} # type: ignore + acquire_lease.metadata = {"url": "{url}/{containerName}"} @distributed_trace_async async def release_lease( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum16], + restype: Union[str, _models.Enum11], lease_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -1174,6 +1218,10 @@ async def release_lease( # pylint: disable=inconsistent-return-statements """[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + :param comp: comp. "lease" Required. + :type comp: str or ~azure.storage.blob.models.Enum16 + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -1187,12 +1235,6 @@ async def release_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "lease". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str :keyword action: Describes what lease action to take. Default value is "release". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1201,16 +1243,19 @@ async def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -1220,23 +1265,23 @@ async def release_lease( # pylint: disable=inconsistent-return-statements request = build_release_lease_request( url=self._config.url, + comp=comp, + restype=restype, lease_id=lease_id, + version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, - comp=comp, - restype=restype, action=action, - version=self._config.version, template_url=self.release_lease.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1260,11 +1305,13 @@ async def release_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - release_lease.metadata = {"url": "{url}/{containerName}"} # type: ignore + release_lease.metadata = {"url": "{url}/{containerName}"} @distributed_trace_async async def renew_lease( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum16], + restype: Union[str, _models.Enum11], lease_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -1274,6 +1321,10 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements """[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + :param comp: comp. "lease" Required. + :type comp: str or ~azure.storage.blob.models.Enum16 + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -1287,12 +1338,6 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "lease". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str :keyword action: Describes what lease action to take. Default value is "renew". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1301,16 +1346,19 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -1320,23 +1368,23 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements request = build_renew_lease_request( url=self._config.url, + comp=comp, + restype=restype, lease_id=lease_id, + version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, - comp=comp, - restype=restype, action=action, - version=self._config.version, template_url=self.renew_lease.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1361,11 +1409,13 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - renew_lease.metadata = {"url": "{url}/{containerName}"} # type: ignore + renew_lease.metadata = {"url": "{url}/{containerName}"} @distributed_trace_async async def break_lease( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum16], + restype: Union[str, _models.Enum11], timeout: Optional[int] = None, break_period: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -1375,6 +1425,10 @@ async def break_lease( # pylint: disable=inconsistent-return-statements """[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + :param comp: comp. "lease" Required. + :type comp: str or ~azure.storage.blob.models.Enum16 + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1394,12 +1448,6 @@ async def break_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "lease". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str :keyword action: Describes what lease action to take. Default value is "break". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1408,16 +1456,19 @@ async def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -1427,23 +1478,23 @@ async def break_lease( # pylint: disable=inconsistent-return-statements request = build_break_lease_request( url=self._config.url, + comp=comp, + restype=restype, + version=self._config.version, timeout=timeout, break_period=break_period, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, - comp=comp, - restype=restype, action=action, - version=self._config.version, template_url=self.break_lease.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1468,11 +1519,13 @@ async def break_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - break_lease.metadata = {"url": "{url}/{containerName}"} # type: ignore + break_lease.metadata = {"url": "{url}/{containerName}"} @distributed_trace_async async def change_lease( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum16], + restype: Union[str, _models.Enum11], lease_id: str, proposed_lease_id: str, timeout: Optional[int] = None, @@ -1483,6 +1536,10 @@ async def change_lease( # pylint: disable=inconsistent-return-statements """[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + :param comp: comp. "lease" Required. + :type comp: str or ~azure.storage.blob.models.Enum16 + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param proposed_lease_id: Proposed lease ID, in a GUID string format. The Blob service returns @@ -1500,12 +1557,6 @@ async def change_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "lease". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str :keyword action: Describes what lease action to take. Default value is "change". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1514,16 +1565,19 @@ async def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -1533,24 +1587,24 @@ async def change_lease( # pylint: disable=inconsistent-return-statements request = build_change_lease_request( url=self._config.url, + comp=comp, + restype=restype, lease_id=lease_id, proposed_lease_id=proposed_lease_id, + version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, - comp=comp, - restype=restype, action=action, - version=self._config.version, template_url=self.change_lease.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1575,21 +1629,27 @@ async def change_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - change_lease.metadata = {"url": "{url}/{containerName}"} # type: ignore + change_lease.metadata = {"url": "{url}/{containerName}"} @distributed_trace_async async def list_blob_flat_segment( self, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum5], prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, "_models.ListBlobsIncludeItem"]]] = None, + include: Optional[List[Union[str, _models.ListBlobsIncludeItem]]] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> _models.ListBlobsFlatSegmentResponse: """[Update] The List Blobs operation returns a list of the blobs under the specified container. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 + :param comp: comp. "list" Required. + :type comp: str or ~azure.storage.blob.models.Enum5 :param prefix: Filters the results to return only containers whose name begins with the specified prefix. Default value is None. :type prefix: str @@ -1619,46 +1679,43 @@ async def list_blob_flat_segment( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "list". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListBlobsFlatSegmentResponse or the result of cls(response) :rtype: ~azure.storage.blob.models.ListBlobsFlatSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "list")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListBlobsFlatSegmentResponse] + cls: ClsType[_models.ListBlobsFlatSegmentResponse] = kwargs.pop("cls", None) request = build_list_blob_flat_segment_request( url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, prefix=prefix, marker=marker, maxresults=maxresults, include=include, timeout=timeout, request_id_parameter=request_id_parameter, - restype=restype, - comp=comp, - version=self._config.version, template_url=self.list_blob_flat_segment.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1685,22 +1742,28 @@ async def list_blob_flat_segment( return deserialized - list_blob_flat_segment.metadata = {"url": "{url}/{containerName}"} # type: ignore + list_blob_flat_segment.metadata = {"url": "{url}/{containerName}"} @distributed_trace_async async def list_blob_hierarchy_segment( self, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum5], delimiter: str, prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, "_models.ListBlobsIncludeItem"]]] = None, + include: Optional[List[Union[str, _models.ListBlobsIncludeItem]]] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> _models.ListBlobsHierarchySegmentResponse: """[Update] The List Blobs operation returns a list of the blobs under the specified container. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 + :param comp: comp. "list" Required. + :type comp: str or ~azure.storage.blob.models.Enum5 :param delimiter: When the request includes this parameter, the operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may be a @@ -1735,47 +1798,44 @@ async def list_blob_hierarchy_segment( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "list". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListBlobsHierarchySegmentResponse or the result of cls(response) :rtype: ~azure.storage.blob.models.ListBlobsHierarchySegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "list")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListBlobsHierarchySegmentResponse] + cls: ClsType[_models.ListBlobsHierarchySegmentResponse] = kwargs.pop("cls", None) request = build_list_blob_hierarchy_segment_request( url=self._config.url, + restype=restype, + comp=comp, delimiter=delimiter, + version=self._config.version, prefix=prefix, marker=marker, maxresults=maxresults, include=include, timeout=timeout, request_id_parameter=request_id_parameter, - restype=restype, - comp=comp, - version=self._config.version, template_url=self.list_blob_hierarchy_segment.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1802,32 +1862,35 @@ async def list_blob_hierarchy_segment( return deserialized - list_blob_hierarchy_segment.metadata = {"url": "{url}/{containerName}"} # type: ignore + list_blob_hierarchy_segment.metadata = {"url": "{url}/{containerName}"} @distributed_trace_async - async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + async def get_account_info( # pylint: disable=inconsistent-return-statements + self, restype: Union[str, _models.Enum8], comp: Union[str, _models.Enum1], **kwargs: Any + ) -> None: """Returns the sku name and account kind. - :keyword restype: restype. Default value is "account". Note that overriding this default value - may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "properties". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str + :param restype: restype. "account" Required. + :type restype: str or ~azure.storage.blob.models.Enum8 + :param comp: comp. "properties" Required. + :type comp: str or ~azure.storage.blob.models.Enum1 :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "account")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_get_account_info_request( url=self._config.url, @@ -1839,9 +1902,9 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1865,4 +1928,4 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco if cls: return cls(pipeline_response, None, response_headers) - get_account_info.metadata = {"url": "{url}/{containerName}"} # type: ignore + get_account_info.metadata = {"url": "{url}/{containerName}"} diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py index 2ef6ac25985d..a9627459eadd 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py @@ -7,6 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -14,6 +15,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -36,6 +38,10 @@ build_upload_pages_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,13 +71,13 @@ async def create( # pylint: disable=inconsistent-return-statements content_length: int, blob_content_length: int, timeout: Optional[int] = None, - tier: Optional[Union[str, "_models.PremiumPageBlobAccessTier"]] = None, + tier: Optional[Union[str, _models.PremiumPageBlobAccessTier]] = None, metadata: Optional[Dict[str, str]] = None, blob_sequence_number: int = 0, request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, + immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, legal_hold: Optional[bool] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -141,14 +147,19 @@ async def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("params", {}) or {} - blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "PageBlob")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + blob_type: Literal["PageBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "PageBlob")) + cls: ClsType[None] = kwargs.pop("cls", None) _blob_content_type = None _blob_content_encoding = None @@ -192,6 +203,7 @@ async def create( # pylint: disable=inconsistent-return-statements url=self._config.url, content_length=content_length, blob_content_length=blob_content_length, + version=self._config.version, timeout=timeout, tier=tier, blob_content_type=_blob_content_type, @@ -218,15 +230,14 @@ async def create( # pylint: disable=inconsistent-return-statements immutability_policy_mode=immutability_policy_mode, legal_hold=legal_hold, blob_type=blob_type, - version=self._config.version, template_url=self.create.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -261,11 +272,12 @@ async def create( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + create.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def upload_pages( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum34], content_length: int, body: IO, transactional_content_md5: Optional[bytes] = None, @@ -282,6 +294,8 @@ async def upload_pages( # pylint: disable=inconsistent-return-statements ) -> None: """The Upload Pages operation writes a range of pages to a page blob. + :param comp: comp. "page" Required. + :type comp: str or ~azure.storage.blob.models.Enum34 :param content_length: The length of the request. Required. :type content_length: int :param body: Initial data. Required. @@ -314,9 +328,6 @@ async def upload_pages( # pylint: disable=inconsistent-return-statements ~azure.storage.blob.models.SequenceNumberAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "page". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword page_write: Required. You may specify one of the following options: @@ -332,16 +343,20 @@ async def upload_pages( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "page")) # type: str - page_write = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _encryption_key = None @@ -380,7 +395,9 @@ async def upload_pages( # pylint: disable=inconsistent-return-statements request = build_upload_pages_request( url=self._config.url, + comp=comp, content_length=content_length, + version=self._config.version, transactional_content_md5=transactional_content_md5, transactional_content_crc64=transactional_content_crc64, timeout=timeout, @@ -399,19 +416,17 @@ async def upload_pages( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, page_write=page_write, content_type=content_type, - version=self._config.version, content=_content, template_url=self.upload_pages.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -451,11 +466,12 @@ async def upload_pages( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - upload_pages.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + upload_pages.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def clear_pages( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum34], content_length: int, timeout: Optional[int] = None, range: Optional[str] = None, @@ -469,6 +485,8 @@ async def clear_pages( # pylint: disable=inconsistent-return-statements ) -> None: """The Clear Pages operation clears a set of pages from a page blob. + :param comp: comp. "page" Required. + :type comp: str or ~azure.storage.blob.models.Enum34 :param content_length: The length of the request. Required. :type content_length: int :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -493,9 +511,6 @@ async def clear_pages( # pylint: disable=inconsistent-return-statements ~azure.storage.blob.models.SequenceNumberAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "page". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword page_write: Required. You may specify one of the following options: @@ -511,15 +526,19 @@ async def clear_pages( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "page")) # type: str - page_write = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "clear")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + page_write: Literal["clear"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "clear")) + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _encryption_key = None @@ -557,7 +576,9 @@ async def clear_pages( # pylint: disable=inconsistent-return-statements request = build_clear_pages_request( url=self._config.url, + comp=comp, content_length=content_length, + version=self._config.version, timeout=timeout, range=range, lease_id=_lease_id, @@ -574,17 +595,15 @@ async def clear_pages( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, page_write=page_write, - version=self._config.version, template_url=self.clear_pages.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -615,11 +634,12 @@ async def clear_pages( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - clear_pages.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + clear_pages.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def upload_pages_from_url( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum34], source_url: str, source_range: str, content_length: int, @@ -640,6 +660,8 @@ async def upload_pages_from_url( # pylint: disable=inconsistent-return-statemen """The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL. + :param comp: comp. "page" Required. + :type comp: str or ~azure.storage.blob.models.Enum34 :param source_url: Specify a URL to the copy source. Required. :type source_url: str :param source_range: Bytes of source data in the specified range. The length of this range @@ -682,9 +704,6 @@ async def upload_pages_from_url( # pylint: disable=inconsistent-return-statemen :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions - :keyword comp: comp. Default value is "page". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword page_write: Required. You may specify one of the following options: @@ -700,15 +719,19 @@ async def upload_pages_from_url( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "page")) # type: str - page_write = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) + cls: ClsType[None] = kwargs.pop("cls", None) _encryption_key = None _encryption_key_sha256 = None @@ -755,10 +778,12 @@ async def upload_pages_from_url( # pylint: disable=inconsistent-return-statemen request = build_upload_pages_from_url_request( url=self._config.url, + comp=comp, source_url=source_url, source_range=source_range, content_length=content_length, range=range, + version=self._config.version, source_content_md5=source_content_md5, source_contentcrc64=source_contentcrc64, timeout=timeout, @@ -781,17 +806,15 @@ async def upload_pages_from_url( # pylint: disable=inconsistent-return-statemen source_if_none_match=_source_if_none_match, request_id_parameter=request_id_parameter, copy_source_authorization=copy_source_authorization, - comp=comp, page_write=page_write, - version=self._config.version, template_url=self.upload_pages_from_url.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -828,11 +851,12 @@ async def upload_pages_from_url( # pylint: disable=inconsistent-return-statemen if cls: return cls(pipeline_response, None, response_headers) - upload_pages_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + upload_pages_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def get_page_ranges( self, + comp: Union[str, _models.Enum35], snapshot: Optional[str] = None, timeout: Optional[int] = None, range: Optional[str] = None, @@ -846,6 +870,8 @@ async def get_page_ranges( """The Get Page Ranges operation returns the list of valid page ranges for a page blob or snapshot of a page blob. + :param comp: comp. "pagelist" Required. + :type comp: str or ~azure.storage.blob.models.Enum35 :param snapshot: The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:` None: """Resize the Blob. + :param comp: comp. "properties" Required. + :type comp: str or ~azure.storage.blob.models.Enum1 :param blob_content_length: This header specifies the maximum size for the page blob, up to 1 TB. The page blob size must be aligned to a 512-byte boundary. Required. :type blob_content_length: int @@ -1158,22 +1192,23 @@ async def resize( # pylint: disable=inconsistent-return-statements :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "properties". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _encryption_key = None @@ -1202,7 +1237,9 @@ async def resize( # pylint: disable=inconsistent-return-statements request = build_resize_request( url=self._config.url, + comp=comp, blob_content_length=blob_content_length, + version=self._config.version, timeout=timeout, lease_id=_lease_id, encryption_key=_encryption_key, @@ -1215,16 +1252,14 @@ async def resize( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, - version=self._config.version, template_url=self.resize.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1251,12 +1286,13 @@ async def resize( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - resize.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + resize.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def update_sequence_number( # pylint: disable=inconsistent-return-statements self, - sequence_number_action: Union[str, "_models.SequenceNumberActionType"], + comp: Union[str, _models.Enum1], + sequence_number_action: Union[str, _models.SequenceNumberActionType], timeout: Optional[int] = None, blob_sequence_number: int = 0, request_id_parameter: Optional[str] = None, @@ -1266,6 +1302,8 @@ async def update_sequence_number( # pylint: disable=inconsistent-return-stateme ) -> None: """Update the sequence number of the blob. + :param comp: comp. "properties" Required. + :type comp: str or ~azure.storage.blob.models.Enum1 :param sequence_number_action: Required if the x-ms-blob-sequence-number header is set for the request. This property applies to page blobs only. This property indicates how the service should modify the blob's sequence number. Known values are: "max", "update", and "increment". @@ -1288,22 +1326,23 @@ async def update_sequence_number( # pylint: disable=inconsistent-return-stateme :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "properties". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _if_modified_since = None @@ -1322,7 +1361,9 @@ async def update_sequence_number( # pylint: disable=inconsistent-return-stateme request = build_update_sequence_number_request( url=self._config.url, + comp=comp, sequence_number_action=sequence_number_action, + version=self._config.version, timeout=timeout, lease_id=_lease_id, if_modified_since=_if_modified_since, @@ -1332,16 +1373,14 @@ async def update_sequence_number( # pylint: disable=inconsistent-return-stateme if_tags=_if_tags, blob_sequence_number=blob_sequence_number, request_id_parameter=request_id_parameter, - comp=comp, - version=self._config.version, template_url=self.update_sequence_number.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1368,11 +1407,12 @@ async def update_sequence_number( # pylint: disable=inconsistent-return-stateme if cls: return cls(pipeline_response, None, response_headers) - update_sequence_number.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + update_sequence_number.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async async def copy_incremental( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum36], copy_source: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -1385,6 +1425,8 @@ async def copy_incremental( # pylint: disable=inconsistent-return-statements the original snapshot and can be read or copied from as usual. This API is supported since REST version 2016-05-31. + :param comp: comp. "incrementalcopy" Required. + :type comp: str or ~azure.storage.blob.models.Enum36 :param copy_source: Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated @@ -1401,22 +1443,23 @@ async def copy_incremental( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "incrementalcopy". Note that overriding this default - value may result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "incrementalcopy")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -1432,7 +1475,9 @@ async def copy_incremental( # pylint: disable=inconsistent-return-statements request = build_copy_incremental_request( url=self._config.url, + comp=comp, copy_source=copy_source, + version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, @@ -1440,16 +1485,14 @@ async def copy_incremental( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, - version=self._config.version, template_url=self.copy_incremental.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1475,4 +1518,4 @@ async def copy_incremental( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - copy_incremental.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + copy_incremental.metadata = {"url": "{url}/{containerName}/{blob}"} diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py index fd98fdac1f30..daf08ab28c8d 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py @@ -13,6 +13,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -60,6 +61,8 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace_async async def set_properties( # pylint: disable=inconsistent-return-statements self, + restype: Union[str, _models.Enum0], + comp: Union[str, _models.Enum1], storage_service_properties: _models.StorageServiceProperties, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -68,6 +71,10 @@ async def set_properties( # pylint: disable=inconsistent-return-statements """Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + :param restype: restype. "service" Required. + :type restype: str or ~azure.storage.blob.models.Enum0 + :param comp: comp. "properties" Required. + :type comp: str or ~azure.storage.blob.models.Enum1 :param storage_service_properties: The StorageService properties. Required. :type storage_service_properties: ~azure.storage.blob.models.StorageServiceProperties :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -79,47 +86,44 @@ async def set_properties( # pylint: disable=inconsistent-return-statements limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword restype: restype. Default value is "service". Note that overriding this default value - may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "properties". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) _content = self._serialize.body(storage_service_properties, "StorageServiceProperties", is_xml=True) request = build_set_properties_request( url=self._config.url, - timeout=timeout, - request_id_parameter=request_id_parameter, restype=restype, comp=comp, - content_type=content_type, version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + content_type=content_type, content=_content, template_url=self.set_properties.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -140,15 +144,24 @@ async def set_properties( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_properties.metadata = {"url": "{url}"} # type: ignore + set_properties.metadata = {"url": "{url}"} @distributed_trace_async async def get_properties( - self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + self, + restype: Union[str, _models.Enum0], + comp: Union[str, _models.Enum1], + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + **kwargs: Any ) -> _models.StorageServiceProperties: """gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + :param restype: restype. "service" Required. + :type restype: str or ~azure.storage.blob.models.Enum0 + :param comp: comp. "properties" Required. + :type comp: str or ~azure.storage.blob.models.Enum1 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -158,42 +171,39 @@ async def get_properties( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword restype: restype. Default value is "service". Note that overriding this default value - may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "properties". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceProperties or the result of cls(response) :rtype: ~azure.storage.blob.models.StorageServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageServiceProperties] + cls: ClsType[_models.StorageServiceProperties] = kwargs.pop("cls", None) request = build_get_properties_request( url=self._config.url, - timeout=timeout, - request_id_parameter=request_id_parameter, restype=restype, comp=comp, version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, template_url=self.get_properties.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -218,16 +228,25 @@ async def get_properties( return deserialized - get_properties.metadata = {"url": "{url}"} # type: ignore + get_properties.metadata = {"url": "{url}"} @distributed_trace_async async def get_statistics( - self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + self, + restype: Union[str, _models.Enum0], + comp: Union[str, _models.Enum3], + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + **kwargs: Any ) -> _models.StorageServiceStats: """Retrieves statistics related to replication for the Blob service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account. + :param restype: restype. "service" Required. + :type restype: str or ~azure.storage.blob.models.Enum0 + :param comp: comp. "stats" Required. + :type comp: str or ~azure.storage.blob.models.Enum3 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -237,42 +256,39 @@ async def get_statistics( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword restype: restype. Default value is "service". Note that overriding this default value - may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "stats". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceStats or the result of cls(response) :rtype: ~azure.storage.blob.models.StorageServiceStats :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "stats")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageServiceStats] + cls: ClsType[_models.StorageServiceStats] = kwargs.pop("cls", None) request = build_get_statistics_request( url=self._config.url, - timeout=timeout, - request_id_parameter=request_id_parameter, restype=restype, comp=comp, version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, template_url=self.get_statistics.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -298,15 +314,16 @@ async def get_statistics( return deserialized - get_statistics.metadata = {"url": "{url}"} # type: ignore + get_statistics.metadata = {"url": "{url}"} @distributed_trace_async async def list_containers_segment( self, + comp: Union[str, _models.Enum5], prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, "_models.ListContainersIncludeType"]]] = None, + include: Optional[List[Union[str, _models.ListContainersIncludeType]]] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any @@ -314,6 +331,8 @@ async def list_containers_segment( """The List Containers Segment operation returns a list of the containers under the specified account. + :param comp: comp. "list" Required. + :type comp: str or ~azure.storage.blob.models.Enum5 :param prefix: Filters the results to return only containers whose name begins with the specified prefix. Default value is None. :type prefix: str @@ -343,41 +362,42 @@ async def list_containers_segment( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword comp: comp. Default value is "list". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListContainersSegmentResponse or the result of cls(response) :rtype: ~azure.storage.blob.models.ListContainersSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "list")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListContainersSegmentResponse] + cls: ClsType[_models.ListContainersSegmentResponse] = kwargs.pop("cls", None) request = build_list_containers_segment_request( url=self._config.url, + comp=comp, + version=self._config.version, prefix=prefix, marker=marker, maxresults=maxresults, include=include, timeout=timeout, request_id_parameter=request_id_parameter, - comp=comp, - version=self._config.version, template_url=self.list_containers_segment.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -402,11 +422,13 @@ async def list_containers_segment( return deserialized - list_containers_segment.metadata = {"url": "{url}"} # type: ignore + list_containers_segment.metadata = {"url": "{url}"} @distributed_trace_async async def get_user_delegation_key( self, + restype: Union[str, _models.Enum0], + comp: Union[str, _models.Enum7], key_info: _models.KeyInfo, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -415,6 +437,10 @@ async def get_user_delegation_key( """Retrieves a user delegation key for the Blob service. This is only a valid operation when using bearer token authentication. + :param restype: restype. "service" Required. + :type restype: str or ~azure.storage.blob.models.Enum0 + :param comp: comp. "userdelegationkey" Required. + :type comp: str or ~azure.storage.blob.models.Enum7 :param key_info: Key information. Required. :type key_info: ~azure.storage.blob.models.KeyInfo :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -426,47 +452,44 @@ async def get_user_delegation_key( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword restype: restype. Default value is "service". Note that overriding this default value - may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "userdelegationkey". Note that overriding this default - value may result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: UserDelegationKey or the result of cls(response) :rtype: ~azure.storage.blob.models.UserDelegationKey :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "userdelegationkey")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserDelegationKey] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) + cls: ClsType[_models.UserDelegationKey] = kwargs.pop("cls", None) _content = self._serialize.body(key_info, "KeyInfo", is_xml=True) request = build_get_user_delegation_key_request( url=self._config.url, - timeout=timeout, - request_id_parameter=request_id_parameter, restype=restype, comp=comp, - content_type=content_type, version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + content_type=content_type, content=_content, template_url=self.get_user_delegation_key.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -492,32 +515,35 @@ async def get_user_delegation_key( return deserialized - get_user_delegation_key.metadata = {"url": "{url}"} # type: ignore + get_user_delegation_key.metadata = {"url": "{url}"} @distributed_trace_async - async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + async def get_account_info( # pylint: disable=inconsistent-return-statements + self, restype: Union[str, _models.Enum8], comp: Union[str, _models.Enum1], **kwargs: Any + ) -> None: """Returns the sku name and account kind. - :keyword restype: restype. Default value is "account". Note that overriding this default value - may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "properties". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str + :param restype: restype. "account" Required. + :type restype: str or ~azure.storage.blob.models.Enum8 + :param comp: comp. "properties" Required. + :type comp: str or ~azure.storage.blob.models.Enum1 :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "account")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_get_account_info_request( url=self._config.url, @@ -529,9 +555,9 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -556,11 +582,12 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco if cls: return cls(pipeline_response, None, response_headers) - get_account_info.metadata = {"url": "{url}"} # type: ignore + get_account_info.metadata = {"url": "{url}"} @distributed_trace_async async def submit_batch( self, + comp: Union[str, _models.Enum9], content_length: int, body: IO, timeout: Optional[int] = None, @@ -569,6 +596,8 @@ async def submit_batch( ) -> AsyncIterator[bytes]: """The Batch operation allows multiple API calls to be embedded into a single HTTP request. + :param comp: comp. "batch" Required. + :type comp: str or ~azure.storage.blob.models.Enum9 :param content_length: The length of the request. Required. :type content_length: int :param body: Initial data. Required. @@ -582,45 +611,46 @@ async def submit_batch( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword comp: comp. Default value is "batch". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Async iterator of the response bytes or the result of cls(response) :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "batch")) # type: str - multipart_content_type = kwargs.pop( + multipart_content_type: str = kwargs.pop( "multipart_content_type", _headers.pop("Content-Type", "application/xml") - ) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[AsyncIterator[bytes]] + ) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _content = body request = build_submit_batch_request( url=self._config.url, + comp=comp, content_length=content_length, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, - comp=comp, multipart_content_type=multipart_content_type, - version=self._config.version, content=_content, template_url=self.submit_batch.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=True, **kwargs ) @@ -639,27 +669,30 @@ async def submit_batch( deserialized = response.stream_download(self._client._pipeline) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - submit_batch.metadata = {"url": "{url}"} # type: ignore + submit_batch.metadata = {"url": "{url}"} @distributed_trace_async async def filter_blobs( self, + comp: Union[str, _models.Enum10], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, where: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, "_models.FilterBlobsIncludeItem"]]] = None, + include: Optional[List[Union[str, _models.FilterBlobsIncludeItem]]] = None, **kwargs: Any ) -> _models.FilterBlobSegment: """The Filter Blobs operation enables callers to list blobs across all containers whose tags match a given search expression. Filter blobs searches across all containers within a storage account but can be scoped within the expression to a single container. + :param comp: comp. "blobs" Required. + :type comp: str or ~azure.storage.blob.models.Enum10 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -689,41 +722,42 @@ async def filter_blobs( :param include: Include this parameter to specify one or more datasets to include in the response. Default value is None. :type include: list[str or ~azure.storage.blob.models.FilterBlobsIncludeItem] - :keyword comp: comp. Default value is "blobs". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FilterBlobSegment or the result of cls(response) :rtype: ~azure.storage.blob.models.FilterBlobSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "blobs")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.FilterBlobSegment] + cls: ClsType[_models.FilterBlobSegment] = kwargs.pop("cls", None) request = build_filter_blobs_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, where=where, marker=marker, maxresults=maxresults, include=include, - comp=comp, - version=self._config.version, template_url=self.filter_blobs.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -749,4 +783,4 @@ async def filter_blobs( return deserialized - filter_blobs.metadata = {"url": "{url}"} # type: ignore + filter_blobs.metadata = {"url": "{url}"} diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/__init__.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/__init__.py index ffa0865eed47..f6db59126353 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/__init__.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/__init__.py @@ -71,6 +71,38 @@ from ._azure_blob_storage_enums import CopyStatusType from ._azure_blob_storage_enums import DeleteSnapshotsOptionType from ._azure_blob_storage_enums import EncryptionAlgorithmType +from ._azure_blob_storage_enums import Enum0 +from ._azure_blob_storage_enums import Enum1 +from ._azure_blob_storage_enums import Enum10 +from ._azure_blob_storage_enums import Enum11 +from ._azure_blob_storage_enums import Enum12 +from ._azure_blob_storage_enums import Enum13 +from ._azure_blob_storage_enums import Enum14 +from ._azure_blob_storage_enums import Enum15 +from ._azure_blob_storage_enums import Enum16 +from ._azure_blob_storage_enums import Enum2 +from ._azure_blob_storage_enums import Enum22 +from ._azure_blob_storage_enums import Enum24 +from ._azure_blob_storage_enums import Enum25 +from ._azure_blob_storage_enums import Enum26 +from ._azure_blob_storage_enums import Enum27 +from ._azure_blob_storage_enums import Enum28 +from ._azure_blob_storage_enums import Enum29 +from ._azure_blob_storage_enums import Enum3 +from ._azure_blob_storage_enums import Enum30 +from ._azure_blob_storage_enums import Enum32 +from ._azure_blob_storage_enums import Enum33 +from ._azure_blob_storage_enums import Enum34 +from ._azure_blob_storage_enums import Enum35 +from ._azure_blob_storage_enums import Enum36 +from ._azure_blob_storage_enums import Enum37 +from ._azure_blob_storage_enums import Enum38 +from ._azure_blob_storage_enums import Enum39 +from ._azure_blob_storage_enums import Enum41 +from ._azure_blob_storage_enums import Enum5 +from ._azure_blob_storage_enums import Enum7 +from ._azure_blob_storage_enums import Enum8 +from ._azure_blob_storage_enums import Enum9 from ._azure_blob_storage_enums import FilterBlobsIncludeItem from ._azure_blob_storage_enums import GeoReplicationStatusType from ._azure_blob_storage_enums import LeaseDurationType @@ -81,12 +113,13 @@ from ._azure_blob_storage_enums import PremiumPageBlobAccessTier from ._azure_blob_storage_enums import PublicAccessType from ._azure_blob_storage_enums import QueryFormatType +from ._azure_blob_storage_enums import QueryRequestQueryType from ._azure_blob_storage_enums import RehydratePriority from ._azure_blob_storage_enums import SequenceNumberActionType from ._azure_blob_storage_enums import SkuName from ._azure_blob_storage_enums import StorageErrorCode 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__ = [ @@ -154,6 +187,38 @@ "CopyStatusType", "DeleteSnapshotsOptionType", "EncryptionAlgorithmType", + "Enum0", + "Enum1", + "Enum10", + "Enum11", + "Enum12", + "Enum13", + "Enum14", + "Enum15", + "Enum16", + "Enum2", + "Enum22", + "Enum24", + "Enum25", + "Enum26", + "Enum27", + "Enum28", + "Enum29", + "Enum3", + "Enum30", + "Enum32", + "Enum33", + "Enum34", + "Enum35", + "Enum36", + "Enum37", + "Enum38", + "Enum39", + "Enum41", + "Enum5", + "Enum7", + "Enum8", + "Enum9", "FilterBlobsIncludeItem", "GeoReplicationStatusType", "LeaseDurationType", @@ -164,6 +229,7 @@ "PremiumPageBlobAccessTier", "PublicAccessType", "QueryFormatType", + "QueryRequestQueryType", "RehydratePriority", "SequenceNumberActionType", "SkuName", diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_azure_blob_storage_enums.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_azure_blob_storage_enums.py index c8aaca620fb2..a9a485527be3 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_azure_blob_storage_enums.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_azure_blob_storage_enums.py @@ -151,6 +151,198 @@ class EncryptionAlgorithmType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AES256 = "AES256" +class Enum0(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum0.""" + + SERVICE = "service" + + +class Enum1(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum1.""" + + PROPERTIES = "properties" + + +class Enum10(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum10.""" + + BLOBS = "blobs" + + +class Enum11(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum11.""" + + CONTAINER = "container" + + +class Enum12(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum12.""" + + METADATA = "metadata" + + +class Enum13(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum13.""" + + ACL = "acl" + + +class Enum14(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum14.""" + + UNDELETE = "undelete" + + +class Enum15(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum15.""" + + RENAME = "rename" + + +class Enum16(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum16.""" + + LEASE = "lease" + + +class Enum2(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum2.""" + + TWO_THOUSAND_TWENTY_ONE12_02 = "2021-12-02" + + +class Enum22(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum22.""" + + EXPIRY = "expiry" + + +class Enum24(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum24.""" + + IMMUTABILITY_POLICIES = "immutabilityPolicies" + + +class Enum25(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum25.""" + + LEGALHOLD = "legalhold" + + +class Enum26(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum26.""" + + SNAPSHOT = "snapshot" + + +class Enum27(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum27.""" + + TRUE = "true" + + +class Enum28(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum28.""" + + COPY = "copy" + + +class Enum29(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum29.""" + + ABORT = "abort" + + +class Enum3(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum3.""" + + STATS = "stats" + + +class Enum30(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum30.""" + + TIER = "tier" + + +class Enum32(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum32.""" + + BLOCK = "block" + + +class Enum33(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum33.""" + + BLOCKLIST = "blocklist" + + +class Enum34(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum34.""" + + PAGE = "page" + + +class Enum35(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum35.""" + + PAGELIST = "pagelist" + + +class Enum36(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum36.""" + + INCREMENTALCOPY = "incrementalcopy" + + +class Enum37(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum37.""" + + APPENDBLOCK = "appendblock" + + +class Enum38(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum38.""" + + SEAL = "seal" + + +class Enum39(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum39.""" + + QUERY = "query" + + +class Enum41(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum41.""" + + TAGS = "tags" + + +class Enum5(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum5.""" + + LIST = "list" + + +class Enum7(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum7.""" + + USERDELEGATIONKEY = "userdelegationkey" + + +class Enum8(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum8.""" + + ACCOUNT = "account" + + +class Enum9(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum9.""" + + BATCH = "batch" + + class FilterBlobsIncludeItem(str, Enum, metaclass=CaseInsensitiveEnumMeta): """FilterBlobsIncludeItem.""" @@ -245,6 +437,12 @@ class QueryFormatType(str, Enum, metaclass=CaseInsensitiveEnumMeta): PARQUET = "parquet" +class QueryRequestQueryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Required. The type of the provided query expression.""" + + SQL = "SQL" + + class RehydratePriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If an object is in rehydrate pending state then this header is returned with priority of rehydrate. Valid values are High and Standard. diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py index 21f534a9a521..06fb39ab4520 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py @@ -13,13 +13,14 @@ from .. import _serialization -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -41,8 +42,13 @@ class AccessPolicy(_serialization.Model): } def __init__( - self, *, start: Optional[str] = None, expiry: Optional[str] = None, permission: Optional[str] = None, **kwargs - ): + self, + *, + start: Optional[str] = None, + expiry: Optional[str] = None, + permission: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword start: the date-time the policy is active. :paramtype start: str @@ -77,7 +83,7 @@ class AppendPositionAccessConditions(_serialization.Model): "append_position": {"key": "appendPosition", "type": "int"}, } - def __init__(self, *, max_size: Optional[int] = None, append_position: Optional[int] = None, **kwargs): + def __init__(self, *, max_size: Optional[int] = None, append_position: Optional[int] = None, **kwargs: Any) -> None: """ :keyword max_size: Optional conditional header. The max length in bytes permitted for the append blob. If the Append Block operation would cause the blob to exceed that limit or if the @@ -117,7 +123,7 @@ class ArrowConfiguration(_serialization.Model): } _xml_map = {"name": "ArrowConfiguration"} - def __init__(self, *, schema: List["_models.ArrowField"], **kwargs): + def __init__(self, *, schema: List["_models.ArrowField"], **kwargs: Any) -> None: """ :keyword schema: Required. :paramtype schema: list[~azure.storage.blob.models.ArrowField] @@ -160,8 +166,8 @@ def __init__( name: Optional[str] = None, precision: Optional[int] = None, scale: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Required. :paramtype type: str @@ -197,7 +203,7 @@ class BlobFlatListSegment(_serialization.Model): } _xml_map = {"name": "Blobs"} - def __init__(self, *, blob_items: List["_models.BlobItemInternal"], **kwargs): + def __init__(self, *, blob_items: List["_models.BlobItemInternal"], **kwargs: Any) -> None: """ :keyword blob_items: Required. :paramtype blob_items: list[~azure.storage.blob.models.BlobItemInternal] @@ -232,8 +238,8 @@ def __init__( *, blob_items: List["_models.BlobItemInternal"], blob_prefixes: Optional[List["_models.BlobPrefix"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword blob_prefixes: :paramtype blob_prefixes: list[~azure.storage.blob.models.BlobPrefix] @@ -285,8 +291,8 @@ def __init__( blob_content_encoding: Optional[str] = None, blob_content_language: Optional[str] = None, blob_content_disposition: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword blob_cache_control: Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read request. @@ -376,8 +382,8 @@ def __init__( blob_tags: Optional["_models.BlobTags"] = None, has_versions_only: Optional[bool] = None, object_replication_metadata: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Required. :paramtype name: ~azure.storage.blob.models.BlobName @@ -430,8 +436,8 @@ class BlobMetadata(_serialization.Model): _xml_map = {"name": "Metadata"} def __init__( - self, *, additional_properties: Optional[Dict[str, str]] = None, encrypted: Optional[str] = None, **kwargs - ): + self, *, additional_properties: Optional[Dict[str, str]] = None, encrypted: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -458,7 +464,7 @@ class BlobName(_serialization.Model): "content": {"key": "content", "type": "str", "xml": {"text": True}}, } - def __init__(self, *, encoded: Optional[bool] = None, content: Optional[str] = None, **kwargs): + def __init__(self, *, encoded: Optional[bool] = None, content: Optional[str] = None, **kwargs: Any) -> None: """ :keyword encoded: Indicates if the blob name is encoded. :paramtype encoded: bool @@ -487,7 +493,7 @@ class BlobPrefix(_serialization.Model): "name": {"key": "Name", "type": "BlobName"}, } - def __init__(self, *, name: "_models.BlobName", **kwargs): + def __init__(self, *, name: "_models.BlobName", **kwargs: Any) -> None: """ :keyword name: Required. :paramtype name: ~azure.storage.blob.models.BlobName @@ -680,8 +686,8 @@ def __init__( # pylint: disable=too-many-locals immutability_policy_expires_on: Optional[datetime.datetime] = None, immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, legal_hold: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword creation_time: :paramtype creation_time: ~datetime.datetime @@ -835,7 +841,7 @@ class BlobTag(_serialization.Model): } _xml_map = {"name": "Tag"} - def __init__(self, *, key: str, value: str, **kwargs): + def __init__(self, *, key: str, value: str, **kwargs: Any) -> None: """ :keyword key: Required. :paramtype key: str @@ -869,7 +875,7 @@ class BlobTags(_serialization.Model): } _xml_map = {"name": "Tags"} - def __init__(self, *, blob_tag_set: List["_models.BlobTag"], **kwargs): + def __init__(self, *, blob_tag_set: List["_models.BlobTag"], **kwargs: Any) -> None: """ :keyword blob_tag_set: Required. :paramtype blob_tag_set: list[~azure.storage.blob.models.BlobTag] @@ -899,7 +905,7 @@ class Block(_serialization.Model): "size": {"key": "Size", "type": "int"}, } - def __init__(self, *, name: str, size: int, **kwargs): + def __init__(self, *, name: str, size: int, **kwargs: Any) -> None: """ :keyword name: The base64 encoded block ID. Required. :paramtype name: str @@ -930,8 +936,8 @@ def __init__( *, committed_blocks: Optional[List["_models.Block"]] = None, uncommitted_blocks: Optional[List["_models.Block"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword committed_blocks: :paramtype committed_blocks: list[~azure.storage.blob.models.Block] @@ -967,8 +973,8 @@ def __init__( committed: Optional[List[str]] = None, uncommitted: Optional[List[str]] = None, latest: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword committed: :paramtype committed: list[str] @@ -1005,7 +1011,7 @@ class ClearRange(_serialization.Model): } _xml_map = {"name": "ClearRange"} - def __init__(self, *, start: int, end: int, **kwargs): + def __init__(self, *, start: int, end: int, **kwargs: Any) -> None: """ :keyword start: Required. :paramtype start: int @@ -1039,8 +1045,8 @@ def __init__( *, default_encryption_scope: Optional[str] = None, prevent_encryption_scope_override: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword default_encryption_scope: Optional. Version 2019-07-07 and later. Specifies the default encryption scope to set on the container and use for all future writes. @@ -1094,8 +1100,8 @@ def __init__( deleted: Optional[bool] = None, version: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Required. :paramtype name: str @@ -1191,8 +1197,8 @@ def __init__( deleted_time: Optional[datetime.datetime] = None, remaining_retention_days: Optional[int] = None, is_immutable_storage_with_versioning_enabled: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword last_modified: Required. :paramtype last_modified: ~datetime.datetime @@ -1240,7 +1246,10 @@ def __init__( class CorsRule(_serialization.Model): - """CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain. + """CORS is an HTTP feature that enables a web application running under one domain to access + resources in another domain. Web browsers implement a security restriction known as same-origin + policy that prevents a web page from calling APIs in a different domain; CORS provides a secure + way to allow one domain (the origin domain) to call APIs in another domain. All required parameters must be populated in order to send to Azure. @@ -1288,8 +1297,8 @@ def __init__( allowed_headers: str, exposed_headers: str, max_age_in_seconds: int, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword allowed_origins: The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request originates. @@ -1346,8 +1355,8 @@ def __init__( encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword encryption_key: Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account @@ -1381,7 +1390,7 @@ class CpkScopeInfo(_serialization.Model): "encryption_scope": {"key": "encryptionScope", "type": "str"}, } - def __init__(self, *, encryption_scope: Optional[str] = None, **kwargs): + def __init__(self, *, encryption_scope: Optional[str] = None, **kwargs: Any) -> None: """ :keyword encryption_scope: Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, @@ -1394,7 +1403,8 @@ def __init__(self, *, encryption_scope: Optional[str] = None, **kwargs): class DelimitedTextConfiguration(_serialization.Model): - """Groups the settings used for interpreting the blob data if the blob is delimited text formatted. + """Groups the settings used for interpreting the blob data if the blob is delimited text + formatted. :ivar column_separator: The string used to separate columns. :vartype column_separator: str @@ -1425,8 +1435,8 @@ def __init__( record_separator: Optional[str] = None, escape_char: Optional[str] = None, headers_present: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword column_separator: The string used to separate columns. :paramtype column_separator: str @@ -1486,8 +1496,8 @@ def __init__( tags: Optional["_models.BlobTags"] = None, version_id: Optional[str] = None, is_current_version: Optional[bool] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Required. :paramtype name: str @@ -1548,8 +1558,8 @@ def __init__( where: str, blobs: List["_models.FilterBlobItem"], next_marker: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_endpoint: Required. :paramtype service_endpoint: str @@ -1592,8 +1602,12 @@ class GeoReplication(_serialization.Model): } def __init__( - self, *, status: Union[str, "_models.GeoReplicationStatusType"], last_sync_time: datetime.datetime, **kwargs - ): + self, + *, + status: Union[str, "_models.GeoReplicationStatusType"], + last_sync_time: datetime.datetime, + **kwargs: Any + ) -> None: """ :keyword status: The status of the secondary location. Required. Known values are: "live", "bootstrap", and "unavailable". @@ -1620,7 +1634,7 @@ class JsonTextConfiguration(_serialization.Model): } _xml_map = {"name": "JsonTextConfiguration"} - def __init__(self, *, record_separator: Optional[str] = None, **kwargs): + def __init__(self, *, record_separator: Optional[str] = None, **kwargs: Any) -> None: """ :keyword record_separator: The string used to separate records. :paramtype record_separator: str @@ -1650,7 +1664,7 @@ class KeyInfo(_serialization.Model): "expiry": {"key": "Expiry", "type": "str"}, } - def __init__(self, *, start: str, expiry: str, **kwargs): + def __init__(self, *, start: str, expiry: str, **kwargs: Any) -> None: """ :keyword start: The date-time the key is active in ISO 8601 UTC time. Required. :paramtype start: str @@ -1674,7 +1688,7 @@ class LeaseAccessConditions(_serialization.Model): "lease_id": {"key": "leaseId", "type": "str"}, } - def __init__(self, *, lease_id: Optional[str] = None, **kwargs): + def __init__(self, *, lease_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword lease_id: If specified, the operation only succeeds if the resource's lease is active and matches this ID. @@ -1732,8 +1746,8 @@ def __init__( marker: Optional[str] = None, max_results: Optional[int] = None, next_marker: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_endpoint: Required. :paramtype service_endpoint: str @@ -1812,8 +1826,8 @@ def __init__( max_results: Optional[int] = None, delimiter: Optional[str] = None, next_marker: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_endpoint: Required. :paramtype service_endpoint: str @@ -1890,8 +1904,8 @@ def __init__( marker: Optional[str] = None, max_results: Optional[int] = None, next_marker: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword service_endpoint: Required. :paramtype service_endpoint: str @@ -1957,8 +1971,8 @@ def __init__( read: bool, write: bool, retention_policy: "_models.RetentionPolicy", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword version: The version of Storage Analytics to configure. Required. :paramtype version: str @@ -2015,8 +2029,8 @@ def __init__( version: Optional[str] = None, include_apis: Optional[bool] = None, retention_policy: Optional["_models.RetentionPolicy"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword version: The version of Storage Analytics to configure. :paramtype version: str @@ -2070,8 +2084,8 @@ def __init__( if_match: Optional[str] = None, if_none_match: Optional[str] = None, if_tags: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword if_modified_since: Specify this header value to operate only on a blob if it has been modified since the specified date/time. @@ -2119,8 +2133,8 @@ def __init__( page_range: Optional[List["_models.PageRange"]] = None, clear_range: Optional[List["_models.ClearRange"]] = None, next_marker: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword page_range: :paramtype page_range: list[~azure.storage.blob.models.PageRange] @@ -2157,7 +2171,7 @@ class PageRange(_serialization.Model): } _xml_map = {"name": "PageRange"} - def __init__(self, *, start: int, end: int, **kwargs): + def __init__(self, *, start: int, end: int, **kwargs: Any) -> None: """ :keyword start: Required. :paramtype start: int @@ -2209,8 +2223,8 @@ def __init__( json_text_configuration: Optional["_models.JsonTextConfiguration"] = None, arrow_configuration: Optional["_models.ArrowConfiguration"] = None, parquet_text_configuration: Optional[JSON] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: The quick query format type. Required. Known values are: "delimited", "json", "arrow", and "parquet". @@ -2237,13 +2251,10 @@ def __init__( class QueryRequest(_serialization.Model): """Groups the set of query request settings. - 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 query_type: Required. The type of the provided query expression. Required. Default value - is "SQL". - :vartype query_type: str + :ivar query_type: Required. The type of the provided query expression. Required. "SQL" + :vartype query_type: str or ~azure.storage.blob.models.QueryRequestQueryType :ivar expression: The query expression in SQL. The maximum size of the query expression is 256KiB. Required. :vartype expression: str @@ -2254,7 +2265,7 @@ class QueryRequest(_serialization.Model): """ _validation = { - "query_type": {"required": True, "constant": True}, + "query_type": {"required": True}, "expression": {"required": True}, } @@ -2266,17 +2277,18 @@ class QueryRequest(_serialization.Model): } _xml_map = {"name": "QueryRequest"} - query_type = "SQL" - def __init__( self, *, + query_type: Union[str, "_models.QueryRequestQueryType"], expression: str, input_serialization: Optional["_models.QuerySerialization"] = None, output_serialization: Optional["_models.QuerySerialization"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ + :keyword query_type: Required. The type of the provided query expression. Required. "SQL" + :paramtype query_type: str or ~azure.storage.blob.models.QueryRequestQueryType :keyword expression: The query expression in SQL. The maximum size of the query expression is 256KiB. Required. :paramtype expression: str @@ -2286,6 +2298,7 @@ def __init__( :paramtype output_serialization: ~azure.storage.blob.models.QuerySerialization """ super().__init__(**kwargs) + self.query_type = query_type self.expression = expression self.input_serialization = input_serialization self.output_serialization = output_serialization @@ -2308,7 +2321,7 @@ class QuerySerialization(_serialization.Model): "format": {"key": "Format", "type": "QueryFormat"}, } - def __init__(self, *, format: "_models.QueryFormat", **kwargs): + def __init__(self, *, format: "_models.QueryFormat", **kwargs: Any) -> None: """ :keyword format: Required. :paramtype format: ~azure.storage.blob.models.QueryFormat @@ -2345,8 +2358,8 @@ class RetentionPolicy(_serialization.Model): } def __init__( - self, *, enabled: bool, days: Optional[int] = None, allow_permanent_delete: Optional[bool] = None, **kwargs - ): + self, *, enabled: bool, days: Optional[int] = None, allow_permanent_delete: Optional[bool] = None, **kwargs: Any + ) -> None: """ :keyword enabled: Indicates whether a retention policy is enabled for the storage service. Required. @@ -2390,8 +2403,8 @@ def __init__( if_sequence_number_less_than_or_equal_to: Optional[int] = None, if_sequence_number_less_than: Optional[int] = None, if_sequence_number_equal_to: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword if_sequence_number_less_than_or_equal_to: Specify this header value to operate only on a blob if it has a sequence number less than or equal to the specified. @@ -2435,8 +2448,8 @@ def __init__( *, id: str, # pylint: disable=redefined-builtin access_policy: Optional["_models.AccessPolicy"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: a unique id. Required. :paramtype id: str @@ -2483,8 +2496,8 @@ def __init__( source_if_match: Optional[str] = None, source_if_none_match: Optional[str] = None, source_if_tags: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword source_if_modified_since: Specify this header value to operate only on a blob if it has been modified since the specified date/time. @@ -2542,8 +2555,8 @@ def __init__( index_document: Optional[str] = None, error_document404_path: Optional[str] = None, default_index_document_path: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword enabled: Indicates whether this account is hosting a static website. Required. :paramtype enabled: bool @@ -2572,7 +2585,7 @@ class StorageError(_serialization.Model): "message": {"key": "Message", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, **kwargs): + def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: :paramtype message: str @@ -2625,8 +2638,8 @@ def __init__( default_service_version: Optional[str] = None, delete_retention_policy: Optional["_models.RetentionPolicy"] = None, static_website: Optional["_models.StaticWebsite"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword logging: Azure Analytics Logging settings. :paramtype logging: ~azure.storage.blob.models.Logging @@ -2669,7 +2682,7 @@ class StorageServiceStats(_serialization.Model): "geo_replication": {"key": "GeoReplication", "type": "GeoReplication"}, } - def __init__(self, *, geo_replication: Optional["_models.GeoReplication"] = None, **kwargs): + def __init__(self, *, geo_replication: Optional["_models.GeoReplication"] = None, **kwargs: Any) -> None: """ :keyword geo_replication: Geo-Replication information for the Secondary Storage Service. :paramtype geo_replication: ~azure.storage.blob.models.GeoReplication @@ -2729,8 +2742,8 @@ def __init__( signed_service: str, signed_version: str, value: str, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword signed_oid: The Azure Active Directory object ID in GUID format. Required. :paramtype signed_oid: str diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/__init__.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/__init__.py index f8feb32687ac..1be05c7aa9a7 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/__init__.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/__init__.py @@ -14,7 +14,7 @@ from ._block_blob_operations import BlockBlobOperations 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__ = [ diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py index 366954fef51d..8a6eebc8cf79 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py @@ -7,6 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -14,6 +15,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -37,6 +43,7 @@ def build_create_request( url: str, *, content_length: int, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, blob_content_type: Optional[str] = None, blob_content_encoding: Optional[str] = None, @@ -48,7 +55,7 @@ def build_create_request( blob_content_disposition: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, + encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, encryption_scope: Optional[str] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -58,15 +65,14 @@ def build_create_request( request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, + immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, legal_hold: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "AppendBlob")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + blob_type: Literal["AppendBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "AppendBlob")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -75,7 +81,7 @@ def build_create_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if timeout is not None: @@ -149,8 +155,10 @@ def build_create_request( def build_append_block_request( url: str, *, + comp: Union[str, _models.Enum37], content_length: int, content: IO, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, transactional_content_md5: Optional[bytes] = None, transactional_content_crc64: Optional[bytes] = None, @@ -159,7 +167,7 @@ def build_append_block_request( append_position: Optional[int] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, + encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, encryption_scope: Optional[str] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -172,9 +180,7 @@ def build_append_block_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "appendblock")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -183,7 +189,7 @@ def build_append_block_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -239,8 +245,10 @@ def build_append_block_request( def build_append_block_from_url_request( url: str, *, + comp: Union[str, _models.Enum37], source_url: str, content_length: int, + version: Union[str, _models.Enum2], source_range: Optional[str] = None, source_content_md5: Optional[bytes] = None, source_contentcrc64: Optional[bytes] = None, @@ -248,7 +256,7 @@ def build_append_block_from_url_request( transactional_content_md5: Optional[bytes] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, + encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, encryption_scope: Optional[str] = None, lease_id: Optional[str] = None, max_size: Optional[int] = None, @@ -269,8 +277,6 @@ def build_append_block_from_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "appendblock")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -279,7 +285,7 @@ def build_append_block_from_url_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -354,6 +360,8 @@ def build_append_block_from_url_request( def build_seal_request( url: str, *, + comp: Union[str, _models.Enum38], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_id: Optional[str] = None, @@ -367,8 +375,6 @@ def build_seal_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "seal")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -377,7 +383,7 @@ def build_seal_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -433,7 +439,7 @@ def create( # pylint: disable=inconsistent-return-statements request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, + immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, legal_hold: Optional[bool] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -493,14 +499,19 @@ def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("params", {}) or {} - blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "AppendBlob")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + blob_type: Literal["AppendBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "AppendBlob")) + cls: ClsType[None] = kwargs.pop("cls", None) _blob_content_type = None _blob_content_encoding = None @@ -543,6 +554,7 @@ def create( # pylint: disable=inconsistent-return-statements request = build_create_request( url=self._config.url, content_length=content_length, + version=self._config.version, timeout=timeout, blob_content_type=_blob_content_type, blob_content_encoding=_blob_content_encoding, @@ -567,15 +579,14 @@ def create( # pylint: disable=inconsistent-return-statements immutability_policy_mode=immutability_policy_mode, legal_hold=legal_hold, blob_type=blob_type, - version=self._config.version, template_url=self.create.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -610,11 +621,12 @@ def create( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + create.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def append_block( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum37], content_length: int, body: IO, timeout: Optional[int] = None, @@ -632,6 +644,8 @@ def append_block( # pylint: disable=inconsistent-return-statements The Append Block operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. + :param comp: comp. "appendblock" Required. + :type comp: str or ~azure.storage.blob.models.Enum37 :param content_length: The length of the request. Required. :type content_length: int :param body: Initial data. Required. @@ -662,23 +676,24 @@ def append_block( # pylint: disable=inconsistent-return-statements :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "appendblock". Note that overriding this default value - may result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "appendblock")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _max_size = None @@ -713,7 +728,9 @@ def append_block( # pylint: disable=inconsistent-return-statements request = build_append_block_request( url=self._config.url, + comp=comp, content_length=content_length, + version=self._config.version, timeout=timeout, transactional_content_md5=transactional_content_md5, transactional_content_crc64=transactional_content_crc64, @@ -730,18 +747,16 @@ def append_block( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, content_type=content_type, - version=self._config.version, content=_content, template_url=self.append_block.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -784,11 +799,12 @@ def append_block( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - append_block.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + append_block.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def append_block_from_url( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum37], source_url: str, content_length: int, source_range: Optional[str] = None, @@ -811,6 +827,8 @@ def append_block_from_url( # pylint: disable=inconsistent-return-statements the blob was created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. + :param comp: comp. "appendblock" Required. + :type comp: str or ~azure.storage.blob.models.Enum37 :param source_url: Specify a URL to the copy source. Required. :type source_url: str :param content_length: The length of the request. Required. @@ -852,22 +870,23 @@ def append_block_from_url( # pylint: disable=inconsistent-return-statements :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions - :keyword comp: comp. Default value is "appendblock". Note that overriding this default value - may result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "appendblock")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _encryption_key = None _encryption_key_sha256 = None @@ -910,8 +929,10 @@ def append_block_from_url( # pylint: disable=inconsistent-return-statements request = build_append_block_from_url_request( url=self._config.url, + comp=comp, source_url=source_url, content_length=content_length, + version=self._config.version, source_range=source_range, source_content_md5=source_content_md5, source_contentcrc64=source_contentcrc64, @@ -935,16 +956,14 @@ def append_block_from_url( # pylint: disable=inconsistent-return-statements source_if_none_match=_source_if_none_match, request_id_parameter=request_id_parameter, copy_source_authorization=copy_source_authorization, - comp=comp, - version=self._config.version, template_url=self.append_block_from_url.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -984,11 +1003,12 @@ def append_block_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - append_block_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + append_block_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def seal( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum38], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -999,6 +1019,8 @@ def seal( # pylint: disable=inconsistent-return-statements """The Seal operation seals the Append Blob to make it read-only. Seal is supported only on version 2019-12-12 version or later. + :param comp: comp. "seal" Required. + :type comp: str or ~azure.storage.blob.models.Enum38 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1015,22 +1037,23 @@ def seal( # pylint: disable=inconsistent-return-statements :param append_position_access_conditions: Parameter group. Default value is None. :type append_position_access_conditions: ~azure.storage.blob.models.AppendPositionAccessConditions - :keyword comp: comp. Default value is "seal". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "seal")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _if_modified_since = None @@ -1050,6 +1073,8 @@ def seal( # pylint: disable=inconsistent-return-statements request = build_seal_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, lease_id=_lease_id, @@ -1058,16 +1083,14 @@ def seal( # pylint: disable=inconsistent-return-statements if_match=_if_match, if_none_match=_if_none_match, append_position=_append_position, - comp=comp, - version=self._config.version, template_url=self.seal.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1092,4 +1115,4 @@ def seal( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - seal.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + seal.metadata = {"url": "{url}/{containerName}/{blob}"} diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py index 3fafd3d77736..a655a5b91e11 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py @@ -7,6 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime +import sys from typing import Any, Callable, Dict, Iterator, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -14,6 +15,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -36,6 +42,7 @@ def build_download_request( url: str, *, + version: Union[str, _models.Enum2], snapshot: Optional[str] = None, version_id: Optional[str] = None, timeout: Optional[int] = None, @@ -45,7 +52,7 @@ def build_download_request( range_get_content_crc64: Optional[bool] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, + encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, if_match: Optional[str] = None, @@ -57,7 +64,6 @@ def build_download_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -66,7 +72,7 @@ def build_download_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if snapshot is not None: @@ -118,13 +124,14 @@ def build_download_request( def build_get_properties_request( url: str, *, + version: Union[str, _models.Enum2], snapshot: Optional[str] = None, version_id: Optional[str] = None, timeout: Optional[int] = None, lease_id: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, + encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, if_match: Optional[str] = None, @@ -136,7 +143,6 @@ def build_get_properties_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -145,7 +151,7 @@ def build_get_properties_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if snapshot is not None: @@ -187,24 +193,24 @@ def build_get_properties_request( def build_delete_request( url: str, *, + version: Union[str, _models.Enum2], snapshot: Optional[str] = None, version_id: Optional[str] = None, timeout: Optional[int] = None, lease_id: Optional[str] = None, - delete_snapshots: Optional[Union[str, "_models.DeleteSnapshotsOptionType"]] = None, + delete_snapshots: Optional[Union[str, _models.DeleteSnapshotsOptionType]] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, if_tags: Optional[str] = None, request_id_parameter: Optional[str] = None, - blob_delete_type: str = "Permanent", + blob_delete_type: Literal["Permanent"] = "Permanent", **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -213,7 +219,7 @@ def build_delete_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if snapshot is not None: @@ -249,13 +255,17 @@ def build_delete_request( def build_undelete_request( - url: str, *, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + url: str, + *, + comp: Union[str, _models.Enum14], + version: Union[str, _models.Enum2], + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "undelete")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -264,7 +274,7 @@ def build_undelete_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -283,7 +293,9 @@ def build_undelete_request( def build_set_expiry_request( url: str, *, - expiry_options: Union[str, "_models.BlobExpiryOptions"], + comp: Union[str, _models.Enum22], + expiry_options: Union[str, _models.BlobExpiryOptions], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, expires_on: Optional[str] = None, @@ -292,8 +304,6 @@ def build_set_expiry_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "expiry")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -302,7 +312,7 @@ def build_set_expiry_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -324,6 +334,8 @@ def build_set_expiry_request( def build_set_http_headers_request( url: str, *, + comp: Union[str, _models.Enum1], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, blob_cache_control: Optional[str] = None, blob_content_type: Optional[str] = None, @@ -343,8 +355,6 @@ def build_set_http_headers_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -353,7 +363,7 @@ def build_set_http_headers_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -402,18 +412,18 @@ def build_set_http_headers_request( def build_set_immutability_policy_request( url: str, *, + comp: Union[str, _models.Enum24], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, if_unmodified_since: Optional[datetime.datetime] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, + immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -422,7 +432,7 @@ def build_set_immutability_policy_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -449,13 +459,17 @@ def build_set_immutability_policy_request( def build_delete_immutability_policy_request( - url: str, *, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + url: str, + *, + comp: Union[str, _models.Enum24], + version: Union[str, _models.Enum2], + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -464,7 +478,7 @@ def build_delete_immutability_policy_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -483,7 +497,9 @@ def build_delete_immutability_policy_request( def build_set_legal_hold_request( url: str, *, + comp: Union[str, _models.Enum25], legal_hold: bool, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any @@ -491,8 +507,6 @@ def build_set_legal_hold_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "legalhold")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -501,7 +515,7 @@ def build_set_legal_hold_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -521,12 +535,14 @@ def build_set_legal_hold_request( def build_set_metadata_request( url: str, *, + comp: Union[str, _models.Enum12], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, lease_id: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, + encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, encryption_scope: Optional[str] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -539,8 +555,6 @@ def build_set_metadata_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "metadata")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -549,7 +563,7 @@ def build_set_metadata_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -592,6 +606,8 @@ def build_set_metadata_request( def build_acquire_lease_request( url: str, *, + comp: Union[str, _models.Enum16], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, duration: Optional[int] = None, proposed_lease_id: Optional[str] = None, @@ -606,9 +622,7 @@ def build_acquire_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -617,7 +631,7 @@ def build_acquire_lease_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -651,7 +665,9 @@ def build_acquire_lease_request( def build_release_lease_request( url: str, *, + comp: Union[str, _models.Enum16], lease_id: str, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -664,9 +680,7 @@ def build_release_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -675,7 +689,7 @@ def build_release_lease_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -706,7 +720,9 @@ def build_release_lease_request( def build_renew_lease_request( url: str, *, + comp: Union[str, _models.Enum16], lease_id: str, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -719,9 +735,7 @@ def build_renew_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -730,7 +744,7 @@ def build_renew_lease_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -761,8 +775,10 @@ def build_renew_lease_request( def build_change_lease_request( url: str, *, + comp: Union[str, _models.Enum16], lease_id: str, proposed_lease_id: str, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -775,9 +791,7 @@ def build_change_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -786,7 +800,7 @@ def build_change_lease_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -818,6 +832,8 @@ def build_change_lease_request( def build_break_lease_request( url: str, *, + comp: Union[str, _models.Enum16], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, break_period: Optional[int] = None, if_modified_since: Optional[datetime.datetime] = None, @@ -831,9 +847,7 @@ def build_break_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -842,7 +856,7 @@ def build_break_lease_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -874,11 +888,13 @@ def build_break_lease_request( def build_create_snapshot_request( url: str, *, + comp: Union[str, _models.Enum26], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, + encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, encryption_scope: Optional[str] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -892,8 +908,6 @@ def build_create_snapshot_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "snapshot")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -902,7 +916,7 @@ def build_create_snapshot_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -946,10 +960,11 @@ def build_start_copy_from_url_request( url: str, *, copy_source: str, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, - rehydrate_priority: Optional[Union[str, "_models.RehydratePriority"]] = None, + tier: Optional[Union[str, _models.AccessTierOptional]] = None, + rehydrate_priority: Optional[Union[str, _models.RehydratePriority]] = None, source_if_modified_since: Optional[datetime.datetime] = None, source_if_unmodified_since: Optional[datetime.datetime] = None, source_if_match: Optional[str] = None, @@ -965,14 +980,13 @@ def build_start_copy_from_url_request( blob_tags_string: Optional[str] = None, seal_blob: Optional[bool] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, + immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, legal_hold: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -981,7 +995,7 @@ def build_start_copy_from_url_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if timeout is not None: @@ -1046,10 +1060,12 @@ def build_start_copy_from_url_request( def build_copy_from_url_request( url: str, *, + x_ms_requires_sync: Union[str, _models.Enum27], copy_source: str, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, + tier: Optional[Union[str, _models.AccessTierOptional]] = None, source_if_modified_since: Optional[datetime.datetime] = None, source_if_unmodified_since: Optional[datetime.datetime] = None, source_if_match: Optional[str] = None, @@ -1064,18 +1080,16 @@ def build_copy_from_url_request( source_content_md5: Optional[bytes] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, + immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, legal_hold: Optional[bool] = None, copy_source_authorization: Optional[str] = None, encryption_scope: Optional[str] = None, - copy_source_tags: Optional[Union[str, "_models.BlobCopySourceTags"]] = None, + copy_source_tags: Optional[Union[str, _models.BlobCopySourceTags]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - x_ms_requires_sync = kwargs.pop("x_ms_requires_sync", _headers.pop("x-ms-requires-sync", "true")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1084,7 +1098,7 @@ def build_copy_from_url_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if timeout is not None: @@ -1154,7 +1168,10 @@ def build_copy_from_url_request( def build_abort_copy_from_url_request( url: str, *, + comp: Union[str, _models.Enum28], + copy_action_abort_constant: Union[str, _models.Enum29], copy_id: str, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, lease_id: Optional[str] = None, request_id_parameter: Optional[str] = None, @@ -1163,11 +1180,6 @@ def build_abort_copy_from_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "copy")) # type: str - copy_action_abort_constant = kwargs.pop( - "copy_action_abort_constant", _headers.pop("x-ms-copy-action", "abort") - ) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1176,7 +1188,7 @@ def build_abort_copy_from_url_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -1199,11 +1211,13 @@ def build_abort_copy_from_url_request( def build_set_tier_request( url: str, *, - tier: Union[str, "_models.AccessTierRequired"], + comp: Union[str, _models.Enum30], + tier: Union[str, _models.AccessTierRequired], + version: Union[str, _models.Enum2], snapshot: Optional[str] = None, version_id: Optional[str] = None, timeout: Optional[int] = None, - rehydrate_priority: Optional[Union[str, "_models.RehydratePriority"]] = None, + rehydrate_priority: Optional[Union[str, _models.RehydratePriority]] = None, request_id_parameter: Optional[str] = None, lease_id: Optional[str] = None, if_tags: Optional[str] = None, @@ -1212,8 +1226,6 @@ def build_set_tier_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "tier")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1222,7 +1234,7 @@ def build_set_tier_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -1249,13 +1261,17 @@ def build_set_tier_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: +def build_get_account_info_request( + url: str, + *, + restype: Union[str, _models.Enum8], + comp: Union[str, _models.Enum1], + version: Union[str, _models.Enum2], + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype = kwargs.pop("restype", _params.pop("restype", "account")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1264,7 +1280,7 @@ def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -1280,12 +1296,14 @@ def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: def build_query_request( url: str, *, + comp: Union[str, _models.Enum39], + version: Union[str, _models.Enum2], snapshot: Optional[str] = None, timeout: Optional[int] = None, lease_id: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, + encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, if_match: Optional[str] = None, @@ -1298,9 +1316,7 @@ def build_query_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "query")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1309,7 +1325,7 @@ def build_query_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -1352,6 +1368,8 @@ def build_query_request( def build_get_tags_request( url: str, *, + comp: Union[str, _models.Enum41], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, snapshot: Optional[str] = None, @@ -1363,8 +1381,6 @@ def build_get_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "tags")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1373,7 +1389,7 @@ def build_get_tags_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -1400,6 +1416,8 @@ def build_get_tags_request( def build_set_tags_request( url: str, *, + comp: Union[str, _models.Enum41], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, version_id: Optional[str] = None, transactional_content_md5: Optional[bytes] = None, @@ -1413,9 +1431,7 @@ def build_set_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "tags")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1424,7 +1440,7 @@ def build_set_tags_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -1533,13 +1549,18 @@ def download( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[Iterator[bytes]] + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _lease_id = None _encryption_key = None @@ -1565,6 +1586,7 @@ def download( request = build_download_request( url=self._config.url, + version=self._config.version, snapshot=snapshot, version_id=version_id, timeout=timeout, @@ -1581,15 +1603,14 @@ def download( if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - version=self._config.version, template_url=self.download.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=True, **kwargs ) @@ -1603,6 +1624,9 @@ def download( response_headers = {} if response.status_code == 200: response_headers["Last-Modified"] = self._deserialize("rfc-1123", response.headers.get("Last-Modified")) + response_headers["x-ms-creation-time"] = self._deserialize( + "rfc-1123", response.headers.get("x-ms-creation-time") + ) response_headers["x-ms-meta"] = self._deserialize("{str}", response.headers.get("x-ms-meta")) response_headers["x-ms-or-policy-id"] = self._deserialize("str", response.headers.get("x-ms-or-policy-id")) response_headers["x-ms-or"] = self._deserialize("{str}", response.headers.get("x-ms-or")) @@ -1681,6 +1705,9 @@ def download( if response.status_code == 206: response_headers["Last-Modified"] = self._deserialize("rfc-1123", response.headers.get("Last-Modified")) + response_headers["x-ms-creation-time"] = self._deserialize( + "rfc-1123", response.headers.get("x-ms-creation-time") + ) response_headers["x-ms-meta"] = self._deserialize("{str}", response.headers.get("x-ms-meta")) response_headers["x-ms-or-policy-id"] = self._deserialize("str", response.headers.get("x-ms-or-policy-id")) response_headers["x-ms-or"] = self._deserialize("{str}", response.headers.get("x-ms-or")) @@ -1761,11 +1788,11 @@ def download( deserialized = response.stream_download(self._client._pipeline) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - download.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + download.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def get_properties( # pylint: disable=inconsistent-return-statements @@ -1812,13 +1839,18 @@ def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _encryption_key = None @@ -1844,6 +1876,7 @@ def get_properties( # pylint: disable=inconsistent-return-statements request = build_get_properties_request( url=self._config.url, + version=self._config.version, snapshot=snapshot, version_id=version_id, timeout=timeout, @@ -1857,15 +1890,14 @@ def get_properties( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - version=self._config.version, template_url=self.get_properties.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1966,7 +1998,7 @@ def get_properties( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + get_properties.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1974,9 +2006,9 @@ def delete( # pylint: disable=inconsistent-return-statements snapshot: Optional[str] = None, version_id: Optional[str] = None, timeout: Optional[int] = None, - delete_snapshots: Optional[Union[str, "_models.DeleteSnapshotsOptionType"]] = None, + delete_snapshots: Optional[Union[str, _models.DeleteSnapshotsOptionType]] = None, request_id_parameter: Optional[str] = None, - blob_delete_type: str = "Permanent", + blob_delete_type: Literal["Permanent"] = "Permanent", lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, **kwargs: Any @@ -2031,13 +2063,18 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _if_modified_since = None @@ -2056,6 +2093,7 @@ def delete( # pylint: disable=inconsistent-return-statements request = build_delete_request( url=self._config.url, + version=self._config.version, snapshot=snapshot, version_id=version_id, timeout=timeout, @@ -2068,15 +2106,14 @@ def delete( # pylint: disable=inconsistent-return-statements if_tags=_if_tags, request_id_parameter=request_id_parameter, blob_delete_type=blob_delete_type, - version=self._config.version, template_url=self.delete.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2098,14 +2135,20 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + delete.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def undelete( # pylint: disable=inconsistent-return-statements - self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + self, + comp: Union[str, _models.Enum14], + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + **kwargs: Any ) -> None: """Undelete a blob that was previously soft deleted. + :param comp: comp. "undelete" Required. + :type comp: str or ~azure.storage.blob.models.Enum14 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -2115,37 +2158,38 @@ def undelete( # pylint: disable=inconsistent-return-statements limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword comp: comp. Default value is "undelete". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "undelete")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_undelete_request( url=self._config.url, - timeout=timeout, - request_id_parameter=request_id_parameter, comp=comp, version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, template_url=self.undelete.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2167,12 +2211,13 @@ def undelete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - undelete.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + undelete.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def set_expiry( # pylint: disable=inconsistent-return-statements self, - expiry_options: Union[str, "_models.BlobExpiryOptions"], + comp: Union[str, _models.Enum22], + expiry_options: Union[str, _models.BlobExpiryOptions], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, expires_on: Optional[str] = None, @@ -2180,6 +2225,8 @@ def set_expiry( # pylint: disable=inconsistent-return-statements ) -> None: """Sets the time a blob will expire and be deleted. + :param comp: comp. "expiry" Required. + :type comp: str or ~azure.storage.blob.models.Enum22 :param expiry_options: Required. Indicates mode of the expiry time. Known values are: "NeverExpire", "RelativeToCreation", "RelativeToNow", and "Absolute". Required. :type expiry_options: str or ~azure.storage.blob.models.BlobExpiryOptions @@ -2194,39 +2241,40 @@ def set_expiry( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param expires_on: The time to set the blob to expiry. Default value is None. :type expires_on: str - :keyword comp: comp. Default value is "expiry". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "expiry")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_set_expiry_request( url=self._config.url, + comp=comp, expiry_options=expiry_options, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, expires_on=expires_on, - comp=comp, - version=self._config.version, template_url=self.set_expiry.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2250,11 +2298,12 @@ def set_expiry( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_expiry.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + set_expiry.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def set_http_headers( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum1], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, @@ -2264,6 +2313,8 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements ) -> None: """The Set HTTP Headers operation sets system properties on the blob. + :param comp: comp. "properties" Required. + :type comp: str or ~azure.storage.blob.models.Enum1 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -2279,22 +2330,23 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "properties". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _blob_cache_control = None _blob_content_type = None @@ -2326,6 +2378,8 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements request = build_set_http_headers_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, blob_cache_control=_blob_cache_control, blob_content_type=_blob_content_type, @@ -2340,16 +2394,14 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements if_tags=_if_tags, blob_content_disposition=_blob_content_disposition, request_id_parameter=request_id_parameter, - comp=comp, - version=self._config.version, template_url=self.set_http_headers.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2376,20 +2428,23 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_http_headers.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + set_http_headers.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def set_immutability_policy( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum24], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, + immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, **kwargs: Any ) -> None: """The Set Immutability Policy operation sets the immutability policy on the blob. + :param comp: comp. "immutabilityPolicies" Required. + :type comp: str or ~azure.storage.blob.models.Enum24 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -2407,22 +2462,23 @@ def set_immutability_policy( # pylint: disable=inconsistent-return-statements :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "immutabilityPolicies". Note that overriding this default - value may result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _if_unmodified_since = None if modified_access_conditions is not None: @@ -2430,21 +2486,21 @@ def set_immutability_policy( # pylint: disable=inconsistent-return-statements request = build_set_immutability_policy_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, if_unmodified_since=_if_unmodified_since, immutability_policy_expiry=immutability_policy_expiry, immutability_policy_mode=immutability_policy_mode, - comp=comp, - version=self._config.version, template_url=self.set_immutability_policy.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2472,14 +2528,20 @@ def set_immutability_policy( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_immutability_policy.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + set_immutability_policy.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def delete_immutability_policy( # pylint: disable=inconsistent-return-statements - self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + self, + comp: Union[str, _models.Enum24], + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + **kwargs: Any ) -> None: """The Delete Immutability Policy operation deletes the immutability policy on the blob. + :param comp: comp. "immutabilityPolicies" Required. + :type comp: str or ~azure.storage.blob.models.Enum24 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -2489,37 +2551,38 @@ def delete_immutability_policy( # pylint: disable=inconsistent-return-statement limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword comp: comp. Default value is "immutabilityPolicies". Note that overriding this default - value may result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_immutability_policy_request( url=self._config.url, - timeout=timeout, - request_id_parameter=request_id_parameter, comp=comp, version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, template_url=self.delete_immutability_policy.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2541,14 +2604,21 @@ def delete_immutability_policy( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, response_headers) - delete_immutability_policy.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + delete_immutability_policy.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def set_legal_hold( # pylint: disable=inconsistent-return-statements - self, legal_hold: bool, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + self, + comp: Union[str, _models.Enum25], + legal_hold: bool, + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + **kwargs: Any ) -> None: """The Set Legal Hold operation sets a legal hold on the blob. + :param comp: comp. "legalhold" Required. + :type comp: str or ~azure.storage.blob.models.Enum25 :param legal_hold: Specified if a legal hold should be set on the blob. Required. :type legal_hold: bool :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -2560,38 +2630,39 @@ def set_legal_hold( # pylint: disable=inconsistent-return-statements limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword comp: comp. Default value is "legalhold". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "legalhold")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_set_legal_hold_request( url=self._config.url, + comp=comp, legal_hold=legal_hold, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, - comp=comp, - version=self._config.version, template_url=self.set_legal_hold.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2614,11 +2685,12 @@ def set_legal_hold( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_legal_hold.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + set_legal_hold.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def set_metadata( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum12], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, request_id_parameter: Optional[str] = None, @@ -2631,6 +2703,8 @@ def set_metadata( # pylint: disable=inconsistent-return-statements """The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-value pairs. + :param comp: comp. "metadata" Required. + :type comp: str or ~azure.storage.blob.models.Enum12 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -2656,22 +2730,23 @@ def set_metadata( # pylint: disable=inconsistent-return-statements :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "metadata". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "metadata")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _encryption_key = None @@ -2700,6 +2775,8 @@ def set_metadata( # pylint: disable=inconsistent-return-statements request = build_set_metadata_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, metadata=metadata, lease_id=_lease_id, @@ -2713,16 +2790,14 @@ def set_metadata( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, - version=self._config.version, template_url=self.set_metadata.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2756,11 +2831,12 @@ def set_metadata( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_metadata.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + set_metadata.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def acquire_lease( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum16], timeout: Optional[int] = None, duration: Optional[int] = None, proposed_lease_id: Optional[str] = None, @@ -2771,6 +2847,8 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements """[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + :param comp: comp. "lease" Required. + :type comp: str or ~azure.storage.blob.models.Enum16 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -2790,9 +2868,6 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "lease". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword action: Describes what lease action to take. Default value is "acquire". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -2801,15 +2876,19 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -2825,6 +2904,8 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements request = build_acquire_lease_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, duration=duration, proposed_lease_id=proposed_lease_id, @@ -2834,17 +2915,15 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, action=action, - version=self._config.version, template_url=self.acquire_lease.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2869,11 +2948,12 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - acquire_lease.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + acquire_lease.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def release_lease( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum16], lease_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -2883,6 +2963,8 @@ def release_lease( # pylint: disable=inconsistent-return-statements """[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + :param comp: comp. "lease" Required. + :type comp: str or ~azure.storage.blob.models.Enum16 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -2896,9 +2978,6 @@ def release_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "lease". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword action: Describes what lease action to take. Default value is "release". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -2907,15 +2986,19 @@ def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -2931,7 +3014,9 @@ def release_lease( # pylint: disable=inconsistent-return-statements request = build_release_lease_request( url=self._config.url, + comp=comp, lease_id=lease_id, + version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, @@ -2939,17 +3024,15 @@ def release_lease( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, action=action, - version=self._config.version, template_url=self.release_lease.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2973,11 +3056,12 @@ def release_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - release_lease.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + release_lease.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def renew_lease( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum16], lease_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -2987,6 +3071,8 @@ def renew_lease( # pylint: disable=inconsistent-return-statements """[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + :param comp: comp. "lease" Required. + :type comp: str or ~azure.storage.blob.models.Enum16 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -3000,9 +3086,6 @@ def renew_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "lease". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword action: Describes what lease action to take. Default value is "renew". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -3011,15 +3094,19 @@ def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -3035,7 +3122,9 @@ def renew_lease( # pylint: disable=inconsistent-return-statements request = build_renew_lease_request( url=self._config.url, + comp=comp, lease_id=lease_id, + version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, @@ -3043,17 +3132,15 @@ def renew_lease( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, action=action, - version=self._config.version, template_url=self.renew_lease.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3078,11 +3165,12 @@ def renew_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - renew_lease.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + renew_lease.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def change_lease( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum16], lease_id: str, proposed_lease_id: str, timeout: Optional[int] = None, @@ -3093,6 +3181,8 @@ def change_lease( # pylint: disable=inconsistent-return-statements """[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + :param comp: comp. "lease" Required. + :type comp: str or ~azure.storage.blob.models.Enum16 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param proposed_lease_id: Proposed lease ID, in a GUID string format. The Blob service returns @@ -3110,9 +3200,6 @@ def change_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "lease". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword action: Describes what lease action to take. Default value is "change". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -3121,15 +3208,19 @@ def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -3145,8 +3236,10 @@ def change_lease( # pylint: disable=inconsistent-return-statements request = build_change_lease_request( url=self._config.url, + comp=comp, lease_id=lease_id, proposed_lease_id=proposed_lease_id, + version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, @@ -3154,17 +3247,15 @@ def change_lease( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, action=action, - version=self._config.version, template_url=self.change_lease.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3189,11 +3280,12 @@ def change_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - change_lease.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + change_lease.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def break_lease( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum16], timeout: Optional[int] = None, break_period: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -3203,6 +3295,8 @@ def break_lease( # pylint: disable=inconsistent-return-statements """[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. + :param comp: comp. "lease" Required. + :type comp: str or ~azure.storage.blob.models.Enum16 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -3222,9 +3316,6 @@ def break_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "lease". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword action: Describes what lease action to take. Default value is "break". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -3233,15 +3324,19 @@ def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -3257,6 +3352,8 @@ def break_lease( # pylint: disable=inconsistent-return-statements request = build_break_lease_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, break_period=break_period, if_modified_since=_if_modified_since, @@ -3265,17 +3362,15 @@ def break_lease( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, action=action, - version=self._config.version, template_url=self.break_lease.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3300,11 +3395,12 @@ def break_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - break_lease.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + break_lease.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def create_snapshot( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum26], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, request_id_parameter: Optional[str] = None, @@ -3316,6 +3412,8 @@ def create_snapshot( # pylint: disable=inconsistent-return-statements ) -> None: """The Create Snapshot operation creates a read-only snapshot of a blob. + :param comp: comp. "snapshot" Required. + :type comp: str or ~azure.storage.blob.models.Enum26 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -3341,22 +3439,23 @@ def create_snapshot( # pylint: disable=inconsistent-return-statements :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword comp: comp. Default value is "snapshot". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "snapshot")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _encryption_key = None _encryption_key_sha256 = None @@ -3385,6 +3484,8 @@ def create_snapshot( # pylint: disable=inconsistent-return-statements request = build_create_snapshot_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, metadata=metadata, encryption_key=_encryption_key, @@ -3398,16 +3499,14 @@ def create_snapshot( # pylint: disable=inconsistent-return-statements if_tags=_if_tags, lease_id=_lease_id, request_id_parameter=request_id_parameter, - comp=comp, - version=self._config.version, template_url=self.create_snapshot.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3436,7 +3535,7 @@ def create_snapshot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - create_snapshot.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + create_snapshot.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def start_copy_from_url( # pylint: disable=inconsistent-return-statements @@ -3444,13 +3543,13 @@ def start_copy_from_url( # pylint: disable=inconsistent-return-statements copy_source: str, timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, - rehydrate_priority: Optional[Union[str, "_models.RehydratePriority"]] = None, + tier: Optional[Union[str, _models.AccessTierOptional]] = None, + rehydrate_priority: Optional[Union[str, _models.RehydratePriority]] = None, request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, seal_blob: Optional[bool] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, + immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, legal_hold: Optional[bool] = None, source_modified_access_conditions: Optional[_models.SourceModifiedAccessConditions] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, @@ -3514,13 +3613,18 @@ def start_copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _source_if_modified_since = None _source_if_unmodified_since = None @@ -3551,6 +3655,7 @@ def start_copy_from_url( # pylint: disable=inconsistent-return-statements request = build_start_copy_from_url_request( url=self._config.url, copy_source=copy_source, + version=self._config.version, timeout=timeout, metadata=metadata, tier=tier, @@ -3572,15 +3677,14 @@ def start_copy_from_url( # pylint: disable=inconsistent-return-statements immutability_policy_expiry=immutability_policy_expiry, immutability_policy_mode=immutability_policy_mode, legal_hold=legal_hold, - version=self._config.version, template_url=self.start_copy_from_url.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3607,23 +3711,24 @@ def start_copy_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - start_copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + start_copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def copy_from_url( # pylint: disable=inconsistent-return-statements self, + x_ms_requires_sync: Union[str, _models.Enum27], copy_source: str, timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, + tier: Optional[Union[str, _models.AccessTierOptional]] = None, request_id_parameter: Optional[str] = None, source_content_md5: Optional[bytes] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, + immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, legal_hold: Optional[bool] = None, copy_source_authorization: Optional[str] = None, - copy_source_tags: Optional[Union[str, "_models.BlobCopySourceTags"]] = None, + copy_source_tags: Optional[Union[str, _models.BlobCopySourceTags]] = None, source_modified_access_conditions: Optional[_models.SourceModifiedAccessConditions] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -3633,6 +3738,9 @@ def copy_from_url( # pylint: disable=inconsistent-return-statements """The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response until the copy is complete. + :param x_ms_requires_sync: This header indicates that this is a synchronous Copy Blob From URL + instead of a Asynchronous Copy Blob. "true" Required. + :type x_ms_requires_sync: str or ~azure.storage.blob.models.Enum27 :param copy_source: Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated @@ -3689,23 +3797,23 @@ def copy_from_url( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :keyword x_ms_requires_sync: This header indicates that this is a synchronous Copy Blob From - URL instead of a Asynchronous Copy Blob. Default value is "true". Note that overriding this - default value may result in unsupported behavior. - :paramtype x_ms_requires_sync: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - x_ms_requires_sync = kwargs.pop("x_ms_requires_sync", _headers.pop("x-ms-requires-sync", "true")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _source_if_modified_since = None _source_if_unmodified_since = None @@ -3736,7 +3844,9 @@ def copy_from_url( # pylint: disable=inconsistent-return-statements request = build_copy_from_url_request( url=self._config.url, + x_ms_requires_sync=x_ms_requires_sync, copy_source=copy_source, + version=self._config.version, timeout=timeout, metadata=metadata, tier=tier, @@ -3759,16 +3869,14 @@ def copy_from_url( # pylint: disable=inconsistent-return-statements copy_source_authorization=copy_source_authorization, encryption_scope=_encryption_scope, copy_source_tags=copy_source_tags, - x_ms_requires_sync=x_ms_requires_sync, - version=self._config.version, template_url=self.copy_from_url.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3802,11 +3910,13 @@ def copy_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def abort_copy_from_url( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum28], + copy_action_abort_constant: Union[str, _models.Enum29], copy_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -3816,6 +3926,10 @@ def abort_copy_from_url( # pylint: disable=inconsistent-return-statements """The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with zero length and full metadata. + :param comp: comp. "copy" Required. + :type comp: str or ~azure.storage.blob.models.Enum28 + :param copy_action_abort_constant: Copy action. "abort" Required. + :type copy_action_abort_constant: str or ~azure.storage.blob.models.Enum29 :param copy_id: The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. Required. :type copy_id: str @@ -3830,28 +3944,23 @@ def abort_copy_from_url( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword comp: comp. Default value is "copy". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str - :keyword copy_action_abort_constant: Copy action. Default value is "abort". Note that - overriding this default value may result in unsupported behavior. - :paramtype copy_action_abort_constant: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "copy")) # type: str - copy_action_abort_constant = kwargs.pop( - "copy_action_abort_constant", _headers.pop("x-ms-copy-action", "abort") - ) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None if lease_access_conditions is not None: @@ -3859,21 +3968,21 @@ def abort_copy_from_url( # pylint: disable=inconsistent-return-statements request = build_abort_copy_from_url_request( url=self._config.url, + comp=comp, + copy_action_abort_constant=copy_action_abort_constant, copy_id=copy_id, + version=self._config.version, timeout=timeout, lease_id=_lease_id, request_id_parameter=request_id_parameter, - comp=comp, - copy_action_abort_constant=copy_action_abort_constant, - version=self._config.version, template_url=self.abort_copy_from_url.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3895,16 +4004,17 @@ def abort_copy_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - abort_copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + abort_copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def set_tier( # pylint: disable=inconsistent-return-statements self, - tier: Union[str, "_models.AccessTierRequired"], + comp: Union[str, _models.Enum30], + tier: Union[str, _models.AccessTierRequired], snapshot: Optional[str] = None, version_id: Optional[str] = None, timeout: Optional[int] = None, - rehydrate_priority: Optional[Union[str, "_models.RehydratePriority"]] = None, + rehydrate_priority: Optional[Union[str, _models.RehydratePriority]] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, @@ -3916,6 +4026,8 @@ def set_tier( # pylint: disable=inconsistent-return-statements the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag. + :param comp: comp. "tier" Required. + :type comp: str or ~azure.storage.blob.models.Enum30 :param tier: Indicates the tier to be set on the blob. Known values are: "P4", "P6", "P10", "P15", "P20", "P30", "P40", "P50", "P60", "P70", "P80", "Hot", "Cool", "Archive", and "Cold". Required. @@ -3946,22 +4058,23 @@ def set_tier( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "tier". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "tier")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _if_tags = None @@ -3972,7 +4085,9 @@ def set_tier( # pylint: disable=inconsistent-return-statements request = build_set_tier_request( url=self._config.url, + comp=comp, tier=tier, + version=self._config.version, snapshot=snapshot, version_id=version_id, timeout=timeout, @@ -3980,16 +4095,14 @@ def set_tier( # pylint: disable=inconsistent-return-statements request_id_parameter=request_id_parameter, lease_id=_lease_id, if_tags=_if_tags, - comp=comp, - version=self._config.version, template_url=self.set_tier.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4018,32 +4131,35 @@ def set_tier( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_tier.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + set_tier.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace - def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + def get_account_info( # pylint: disable=inconsistent-return-statements + self, restype: Union[str, _models.Enum8], comp: Union[str, _models.Enum1], **kwargs: Any + ) -> None: """Returns the sku name and account kind. - :keyword restype: restype. Default value is "account". Note that overriding this default value - may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "properties". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str + :param restype: restype. "account" Required. + :type restype: str or ~azure.storage.blob.models.Enum8 + :param comp: comp. "properties" Required. + :type comp: str or ~azure.storage.blob.models.Enum1 :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "account")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_get_account_info_request( url=self._config.url, @@ -4055,9 +4171,9 @@ def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsiste 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4081,11 +4197,12 @@ def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsiste if cls: return cls(pipeline_response, None, response_headers) - get_account_info.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + get_account_info.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def query( self, + comp: Union[str, _models.Enum39], snapshot: Optional[str] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -4098,6 +4215,8 @@ def query( """The Query operation enables users to select/project on blob data by providing simple query expressions. + :param comp: comp. "query" Required. + :type comp: str or ~azure.storage.blob.models.Enum39 :param snapshot: The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:` _models.BlobTags: """The Get Tags operation enables users to get the tags associated with a blob. + :param comp: comp. "tags" Required. + :type comp: str or ~azure.storage.blob.models.Enum41 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -4368,22 +4491,23 @@ def get_tags( :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword comp: comp. Default value is "tags". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: BlobTags or the result of cls(response) :rtype: ~azure.storage.blob.models.BlobTags :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "tags")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BlobTags] + cls: ClsType[_models.BlobTags] = kwargs.pop("cls", None) _if_tags = None _lease_id = None @@ -4394,22 +4518,22 @@ def get_tags( request = build_get_tags_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, snapshot=snapshot, version_id=version_id, if_tags=_if_tags, lease_id=_lease_id, - comp=comp, - version=self._config.version, template_url=self.get_tags.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4435,11 +4559,12 @@ def get_tags( return deserialized - get_tags.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + get_tags.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def set_tags( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum41], timeout: Optional[int] = None, version_id: Optional[str] = None, transactional_content_md5: Optional[bytes] = None, @@ -4452,6 +4577,8 @@ def set_tags( # pylint: disable=inconsistent-return-statements ) -> None: """The Set Tags operation enables users to set tags on a blob. + :param comp: comp. "tags" Required. + :type comp: str or ~azure.storage.blob.models.Enum41 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -4477,23 +4604,24 @@ def set_tags( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param tags: Blob tags. Default value is None. :type tags: ~azure.storage.blob.models.BlobTags - :keyword comp: comp. Default value is "tags". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "tags")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_tags = None _lease_id = None @@ -4508,6 +4636,8 @@ def set_tags( # pylint: disable=inconsistent-return-statements request = build_set_tags_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, version_id=version_id, transactional_content_md5=transactional_content_md5, @@ -4515,18 +4645,16 @@ def set_tags( # pylint: disable=inconsistent-return-statements request_id_parameter=request_id_parameter, if_tags=_if_tags, lease_id=_lease_id, - comp=comp, content_type=content_type, - version=self._config.version, content=_content, template_url=self.set_tags.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4548,4 +4676,4 @@ def set_tags( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_tags.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + set_tags.metadata = {"url": "{url}/{containerName}/{blob}"} diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py index 5435f0a2c33d..820f4d9731ca 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py @@ -7,6 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -14,6 +15,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,6 +44,7 @@ def build_upload_request( *, content_length: int, content: IO, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, transactional_content_md5: Optional[bytes] = None, blob_content_type: Optional[str] = None, @@ -50,9 +57,9 @@ def build_upload_request( blob_content_disposition: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, + encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, encryption_scope: Optional[str] = None, - tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, + tier: Optional[Union[str, _models.AccessTierOptional]] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, if_match: Optional[str] = None, @@ -61,7 +68,7 @@ def build_upload_request( request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, + immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, legal_hold: Optional[bool] = None, transactional_content_crc64: Optional[bytes] = None, **kwargs: Any @@ -69,9 +76,8 @@ def build_upload_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + blob_type: Literal["BlockBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -80,7 +86,7 @@ def build_upload_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if timeout is not None: @@ -168,6 +174,7 @@ def build_put_blob_from_url_request( *, content_length: int, copy_source: str, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, transactional_content_md5: Optional[bytes] = None, blob_content_type: Optional[str] = None, @@ -180,9 +187,9 @@ def build_put_blob_from_url_request( blob_content_disposition: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, + encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, encryption_scope: Optional[str] = None, - tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, + tier: Optional[Union[str, _models.AccessTierOptional]] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, if_match: Optional[str] = None, @@ -198,14 +205,13 @@ def build_put_blob_from_url_request( blob_tags_string: Optional[str] = None, copy_source_blob_properties: Optional[bool] = None, copy_source_authorization: Optional[str] = None, - copy_source_tags: Optional[Union[str, "_models.BlobCopySourceTags"]] = None, + copy_source_tags: Optional[Union[str, _models.BlobCopySourceTags]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + blob_type: Literal["BlockBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -214,7 +220,7 @@ def build_put_blob_from_url_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if timeout is not None: @@ -311,16 +317,18 @@ def build_put_blob_from_url_request( def build_stage_block_request( url: str, *, + comp: Union[str, _models.Enum32], block_id: str, content_length: int, content: IO, + version: Union[str, _models.Enum2], transactional_content_md5: Optional[bytes] = None, transactional_content_crc64: Optional[bytes] = None, timeout: Optional[int] = None, lease_id: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, + encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, encryption_scope: Optional[str] = None, request_id_parameter: Optional[str] = None, **kwargs: Any @@ -328,9 +336,7 @@ def build_stage_block_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "block")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -339,7 +345,7 @@ def build_stage_block_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -382,16 +388,18 @@ def build_stage_block_request( def build_stage_block_from_url_request( url: str, *, + comp: Union[str, _models.Enum32], block_id: str, content_length: int, source_url: str, + version: Union[str, _models.Enum2], source_range: Optional[str] = None, source_content_md5: Optional[bytes] = None, source_contentcrc64: Optional[bytes] = None, timeout: Optional[int] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, + encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, encryption_scope: Optional[str] = None, lease_id: Optional[str] = None, source_if_modified_since: Optional[datetime.datetime] = None, @@ -405,8 +413,6 @@ def build_stage_block_from_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "block")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -415,7 +421,7 @@ def build_stage_block_from_url_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -473,7 +479,9 @@ def build_stage_block_from_url_request( def build_commit_block_list_request( url: str, *, + comp: Union[str, _models.Enum33], content: Any, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, blob_cache_control: Optional[str] = None, blob_content_type: Optional[str] = None, @@ -487,9 +495,9 @@ def build_commit_block_list_request( blob_content_disposition: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, + encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, encryption_scope: Optional[str] = None, - tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, + tier: Optional[Union[str, _models.AccessTierOptional]] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, if_match: Optional[str] = None, @@ -498,16 +506,14 @@ def build_commit_block_list_request( request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, + immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, legal_hold: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "blocklist")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -516,7 +522,7 @@ def build_commit_block_list_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -601,8 +607,10 @@ def build_commit_block_list_request( def build_get_block_list_request( url: str, *, + comp: Union[str, _models.Enum33], + version: Union[str, _models.Enum2], snapshot: Optional[str] = None, - list_type: Union[str, "_models.BlockListType"] = "committed", + list_type: Union[str, _models.BlockListType] = "committed", timeout: Optional[int] = None, lease_id: Optional[str] = None, if_tags: Optional[str] = None, @@ -612,8 +620,6 @@ def build_get_block_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "blocklist")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -622,7 +628,7 @@ def build_get_block_list_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -672,11 +678,11 @@ def upload( # pylint: disable=inconsistent-return-statements timeout: Optional[int] = None, transactional_content_md5: Optional[bytes] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, + tier: Optional[Union[str, _models.AccessTierOptional]] = None, request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, + immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, legal_hold: Optional[bool] = None, transactional_content_crc64: Optional[bytes] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, @@ -753,15 +759,20 @@ def upload( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("params", {}) or {} - blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + blob_type: Literal["BlockBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + cls: ClsType[None] = kwargs.pop("cls", None) _blob_content_type = None _blob_content_encoding = None @@ -805,6 +816,7 @@ def upload( # pylint: disable=inconsistent-return-statements request = build_upload_request( url=self._config.url, content_length=content_length, + version=self._config.version, timeout=timeout, transactional_content_md5=transactional_content_md5, blob_content_type=_blob_content_type, @@ -833,16 +845,15 @@ def upload( # pylint: disable=inconsistent-return-statements transactional_content_crc64=transactional_content_crc64, blob_type=blob_type, content_type=content_type, - version=self._config.version, content=_content, template_url=self.upload.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -877,7 +888,7 @@ def upload( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - upload.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + upload.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def put_blob_from_url( # pylint: disable=inconsistent-return-statements @@ -887,13 +898,13 @@ def put_blob_from_url( # pylint: disable=inconsistent-return-statements timeout: Optional[int] = None, transactional_content_md5: Optional[bytes] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, + tier: Optional[Union[str, _models.AccessTierOptional]] = None, request_id_parameter: Optional[str] = None, source_content_md5: Optional[bytes] = None, blob_tags_string: Optional[str] = None, copy_source_blob_properties: Optional[bool] = None, copy_source_authorization: Optional[str] = None, - copy_source_tags: Optional[Union[str, "_models.BlobCopySourceTags"]] = None, + copy_source_tags: Optional[Union[str, _models.BlobCopySourceTags]] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, cpk_info: Optional[_models.CpkInfo] = None, @@ -977,14 +988,19 @@ def put_blob_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("params", {}) or {} - blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + blob_type: Literal["BlockBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) + cls: ClsType[None] = kwargs.pop("cls", None) _blob_content_type = None _blob_content_encoding = None @@ -1039,6 +1055,7 @@ def put_blob_from_url( # pylint: disable=inconsistent-return-statements url=self._config.url, content_length=content_length, copy_source=copy_source, + version=self._config.version, timeout=timeout, transactional_content_md5=transactional_content_md5, blob_content_type=_blob_content_type, @@ -1071,15 +1088,14 @@ def put_blob_from_url( # pylint: disable=inconsistent-return-statements copy_source_authorization=copy_source_authorization, copy_source_tags=copy_source_tags, blob_type=blob_type, - version=self._config.version, template_url=self.put_blob_from_url.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1114,11 +1130,12 @@ def put_blob_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - put_blob_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + put_blob_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def stage_block( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum32], block_id: str, content_length: int, body: IO, @@ -1133,6 +1150,8 @@ def stage_block( # pylint: disable=inconsistent-return-statements ) -> None: """The Stage Block operation creates a new block to be committed as part of a blob. + :param comp: comp. "block" Required. + :type comp: str or ~azure.storage.blob.models.Enum32 :param block_id: A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the same size for each block. Required. @@ -1162,23 +1181,24 @@ def stage_block( # pylint: disable=inconsistent-return-statements :type cpk_info: ~azure.storage.blob.models.CpkInfo :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :keyword comp: comp. Default value is "block". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "block")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _encryption_key = None @@ -1197,8 +1217,10 @@ def stage_block( # pylint: disable=inconsistent-return-statements request = build_stage_block_request( url=self._config.url, + comp=comp, block_id=block_id, content_length=content_length, + version=self._config.version, transactional_content_md5=transactional_content_md5, transactional_content_crc64=transactional_content_crc64, timeout=timeout, @@ -1208,18 +1230,16 @@ def stage_block( # pylint: disable=inconsistent-return-statements encryption_algorithm=_encryption_algorithm, encryption_scope=_encryption_scope, request_id_parameter=request_id_parameter, - comp=comp, content_type=content_type, - version=self._config.version, content=_content, template_url=self.stage_block.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1254,11 +1274,12 @@ def stage_block( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - stage_block.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + stage_block.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def stage_block_from_url( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum32], block_id: str, content_length: int, source_url: str, @@ -1277,6 +1298,8 @@ def stage_block_from_url( # pylint: disable=inconsistent-return-statements """The Stage Block operation creates a new block to be committed as part of a blob where the contents are read from a URL. + :param comp: comp. "block" Required. + :type comp: str or ~azure.storage.blob.models.Enum32 :param block_id: A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the same size for each block. Required. @@ -1314,22 +1337,23 @@ def stage_block_from_url( # pylint: disable=inconsistent-return-statements :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions - :keyword comp: comp. Default value is "block". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "block")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _encryption_key = None _encryption_key_sha256 = None @@ -1356,9 +1380,11 @@ def stage_block_from_url( # pylint: disable=inconsistent-return-statements request = build_stage_block_from_url_request( url=self._config.url, + comp=comp, block_id=block_id, content_length=content_length, source_url=source_url, + version=self._config.version, source_range=source_range, source_content_md5=source_content_md5, source_contentcrc64=source_contentcrc64, @@ -1374,16 +1400,14 @@ def stage_block_from_url( # pylint: disable=inconsistent-return-statements source_if_none_match=_source_if_none_match, request_id_parameter=request_id_parameter, copy_source_authorization=copy_source_authorization, - comp=comp, - version=self._config.version, template_url=self.stage_block_from_url.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1418,21 +1442,22 @@ def stage_block_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - stage_block_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + stage_block_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def commit_block_list( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum33], blocks: _models.BlockLookupList, timeout: Optional[int] = None, transactional_content_md5: Optional[bytes] = None, transactional_content_crc64: Optional[bytes] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, + tier: Optional[Union[str, _models.AccessTierOptional]] = None, request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, + immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, legal_hold: Optional[bool] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -1449,6 +1474,8 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements or from the uncommitted block list, or to commit the most recently uploaded version of the block, whichever list it may belong to. + :param comp: comp. "blocklist" Required. + :type comp: str or ~azure.storage.blob.models.Enum33 :param blocks: Blob Blocks. Required. :type blocks: ~azure.storage.blob.models.BlockLookupList :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -1499,23 +1526,24 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "blocklist". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "blocklist")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) _blob_cache_control = None _blob_content_type = None @@ -1558,6 +1586,8 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements request = build_commit_block_list_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, blob_cache_control=_blob_cache_control, blob_content_type=_blob_content_type, @@ -1584,18 +1614,16 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements immutability_policy_expiry=immutability_policy_expiry, immutability_policy_mode=immutability_policy_mode, legal_hold=legal_hold, - comp=comp, content_type=content_type, - version=self._config.version, content=_content, template_url=self.commit_block_list.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1633,13 +1661,14 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - commit_block_list.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + commit_block_list.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def get_block_list( self, + comp: Union[str, _models.Enum33], snapshot: Optional[str] = None, - list_type: Union[str, "_models.BlockListType"] = "committed", + list_type: Union[str, _models.BlockListType] = "committed", timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -1649,6 +1678,8 @@ def get_block_list( """The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob. + :param comp: comp. "blocklist" Required. + :type comp: str or ~azure.storage.blob.models.Enum33 :param snapshot: The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:`= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -36,9 +42,11 @@ def build_create_request( url: str, *, + restype: Union[str, _models.Enum11], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, - access: Optional[Union[str, "_models.PublicAccessType"]] = None, + access: Optional[Union[str, _models.PublicAccessType]] = None, request_id_parameter: Optional[str] = None, default_encryption_scope: Optional[str] = None, prevent_encryption_scope_override: Optional[bool] = None, @@ -47,8 +55,6 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -57,7 +63,7 @@ def build_create_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -88,6 +94,8 @@ def build_create_request( def build_get_properties_request( url: str, *, + restype: Union[str, _models.Enum11], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, lease_id: Optional[str] = None, request_id_parameter: Optional[str] = None, @@ -96,8 +104,6 @@ def build_get_properties_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -106,7 +112,7 @@ def build_get_properties_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -127,6 +133,8 @@ def build_get_properties_request( def build_delete_request( url: str, *, + restype: Union[str, _models.Enum11], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, lease_id: Optional[str] = None, if_modified_since: Optional[datetime.datetime] = None, @@ -137,8 +145,6 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -147,7 +153,7 @@ def build_delete_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -172,6 +178,9 @@ def build_delete_request( def build_set_metadata_request( url: str, *, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum12], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, lease_id: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, @@ -182,9 +191,6 @@ def build_set_metadata_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "metadata")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -193,7 +199,7 @@ def build_set_metadata_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -219,6 +225,9 @@ def build_set_metadata_request( def build_get_access_policy_request( url: str, *, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum13], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, lease_id: Optional[str] = None, request_id_parameter: Optional[str] = None, @@ -227,9 +236,6 @@ def build_get_access_policy_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "acl")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -238,7 +244,7 @@ def build_get_access_policy_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -260,9 +266,12 @@ def build_get_access_policy_request( def build_set_access_policy_request( url: str, *, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum13], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, lease_id: Optional[str] = None, - access: Optional[Union[str, "_models.PublicAccessType"]] = None, + access: Optional[Union[str, _models.PublicAccessType]] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, request_id_parameter: Optional[str] = None, @@ -272,10 +281,7 @@ def build_set_access_policy_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "acl")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -284,7 +290,7 @@ def build_set_access_policy_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -314,6 +320,9 @@ def build_set_access_policy_request( def build_restore_request( url: str, *, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum14], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, deleted_container_name: Optional[str] = None, @@ -323,9 +332,6 @@ def build_restore_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "undelete")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -334,7 +340,7 @@ def build_restore_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -362,7 +368,10 @@ def build_restore_request( def build_rename_request( url: str, *, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum15], source_container_name: str, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, source_lease_id: Optional[str] = None, @@ -371,9 +380,6 @@ def build_rename_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "rename")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -382,7 +388,7 @@ def build_rename_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -405,8 +411,11 @@ def build_rename_request( def build_submit_batch_request( url: str, *, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum9], content_length: int, content: IO, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any @@ -414,12 +423,7 @@ def build_submit_batch_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "batch")) # type: str - multipart_content_type = kwargs.pop( - "multipart_content_type", _headers.pop("Content-Type", None) - ) # type: Optional[str] - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + multipart_content_type: Optional[str] = kwargs.pop("multipart_content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -428,7 +432,7 @@ def build_submit_batch_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -451,20 +455,20 @@ def build_submit_batch_request( def build_filter_blobs_request( url: str, *, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum10], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, where: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, "_models.FilterBlobsIncludeItem"]]] = None, + include: Optional[List[Union[str, _models.FilterBlobsIncludeItem]]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "blobs")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -473,7 +477,7 @@ def build_filter_blobs_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -501,6 +505,9 @@ def build_filter_blobs_request( def build_acquire_lease_request( url: str, *, + comp: Union[str, _models.Enum16], + restype: Union[str, _models.Enum11], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, duration: Optional[int] = None, proposed_lease_id: Optional[str] = None, @@ -512,10 +519,7 @@ def build_acquire_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -524,7 +528,7 @@ def build_acquire_lease_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -553,7 +557,10 @@ def build_acquire_lease_request( def build_release_lease_request( url: str, *, + comp: Union[str, _models.Enum16], + restype: Union[str, _models.Enum11], lease_id: str, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -563,10 +570,7 @@ def build_release_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -575,7 +579,7 @@ def build_release_lease_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -601,7 +605,10 @@ def build_release_lease_request( def build_renew_lease_request( url: str, *, + comp: Union[str, _models.Enum16], + restype: Union[str, _models.Enum11], lease_id: str, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -611,10 +618,7 @@ def build_renew_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -623,7 +627,7 @@ def build_renew_lease_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -649,6 +653,9 @@ def build_renew_lease_request( def build_break_lease_request( url: str, *, + comp: Union[str, _models.Enum16], + restype: Union[str, _models.Enum11], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, break_period: Optional[int] = None, if_modified_since: Optional[datetime.datetime] = None, @@ -659,10 +666,7 @@ def build_break_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -671,7 +675,7 @@ def build_break_lease_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -698,8 +702,11 @@ def build_break_lease_request( def build_change_lease_request( url: str, *, + comp: Union[str, _models.Enum16], + restype: Union[str, _models.Enum11], lease_id: str, proposed_lease_id: str, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -709,10 +716,7 @@ def build_change_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -721,7 +725,7 @@ def build_change_lease_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -748,10 +752,13 @@ def build_change_lease_request( def build_list_blob_flat_segment_request( url: str, *, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum5], + version: Union[str, _models.Enum2], prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, "_models.ListBlobsIncludeItem"]]] = None, + include: Optional[List[Union[str, _models.ListBlobsIncludeItem]]] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any @@ -759,9 +766,6 @@ def build_list_blob_flat_segment_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "list")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -770,7 +774,7 @@ def build_list_blob_flat_segment_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -798,11 +802,14 @@ def build_list_blob_flat_segment_request( def build_list_blob_hierarchy_segment_request( url: str, *, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum5], delimiter: str, + version: Union[str, _models.Enum2], prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, "_models.ListBlobsIncludeItem"]]] = None, + include: Optional[List[Union[str, _models.ListBlobsIncludeItem]]] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any @@ -810,9 +817,6 @@ def build_list_blob_hierarchy_segment_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "list")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -821,7 +825,7 @@ def build_list_blob_hierarchy_segment_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -847,13 +851,17 @@ def build_list_blob_hierarchy_segment_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: +def build_get_account_info_request( + url: str, + *, + restype: Union[str, _models.Enum8], + comp: Union[str, _models.Enum1], + version: Union[str, _models.Enum2], + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype = kwargs.pop("restype", _params.pop("restype", "account")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -862,7 +870,7 @@ def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -897,9 +905,10 @@ def __init__(self, *args, **kwargs): @distributed_trace def create( # pylint: disable=inconsistent-return-statements self, + restype: Union[str, _models.Enum11], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, - access: Optional[Union[str, "_models.PublicAccessType"]] = None, + access: Optional[Union[str, _models.PublicAccessType]] = None, request_id_parameter: Optional[str] = None, container_cpk_scope_info: Optional[_models.ContainerCpkScopeInfo] = None, **kwargs: Any @@ -907,6 +916,8 @@ def create( # pylint: disable=inconsistent-return-statements """creates a new container under the specified account. If the container with the same name already exists, the operation fails. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -929,22 +940,23 @@ def create( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param container_cpk_scope_info: Parameter group. Default value is None. :type container_cpk_scope_info: ~azure.storage.blob.models.ContainerCpkScopeInfo - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _default_encryption_scope = None _prevent_encryption_scope_override = None @@ -954,22 +966,22 @@ def create( # pylint: disable=inconsistent-return-statements request = build_create_request( url=self._config.url, + restype=restype, + version=self._config.version, timeout=timeout, metadata=metadata, access=access, request_id_parameter=request_id_parameter, default_encryption_scope=_default_encryption_scope, prevent_encryption_scope_override=_prevent_encryption_scope_override, - restype=restype, - version=self._config.version, template_url=self.create.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -993,11 +1005,12 @@ def create( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {"url": "{url}/{containerName}"} # type: ignore + create.metadata = {"url": "{url}/{containerName}"} @distributed_trace def get_properties( # pylint: disable=inconsistent-return-statements self, + restype: Union[str, _models.Enum11], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -1006,6 +1019,8 @@ def get_properties( # pylint: disable=inconsistent-return-statements """returns all user-defined metadata and system properties for the specified container. The data returned does not include the container's list of blobs. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1017,22 +1032,23 @@ def get_properties( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None if lease_access_conditions is not None: @@ -1040,19 +1056,19 @@ def get_properties( # pylint: disable=inconsistent-return-statements request = build_get_properties_request( url=self._config.url, + restype=restype, + version=self._config.version, timeout=timeout, lease_id=_lease_id, request_id_parameter=request_id_parameter, - restype=restype, - version=self._config.version, template_url=self.get_properties.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1096,11 +1112,12 @@ def get_properties( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {"url": "{url}/{containerName}"} # type: ignore + get_properties.metadata = {"url": "{url}/{containerName}"} @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, + restype: Union[str, _models.Enum11], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -1110,6 +1127,8 @@ def delete( # pylint: disable=inconsistent-return-statements """operation marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1123,22 +1142,23 @@ def delete( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _if_modified_since = None @@ -1151,21 +1171,21 @@ def delete( # pylint: disable=inconsistent-return-statements request = build_delete_request( url=self._config.url, + restype=restype, + version=self._config.version, timeout=timeout, lease_id=_lease_id, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, - restype=restype, - version=self._config.version, template_url=self.delete.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1187,11 +1207,13 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {"url": "{url}/{containerName}"} # type: ignore + delete.metadata = {"url": "{url}/{containerName}"} @distributed_trace def set_metadata( # pylint: disable=inconsistent-return-statements self, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum12], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, request_id_parameter: Optional[str] = None, @@ -1201,6 +1223,10 @@ def set_metadata( # pylint: disable=inconsistent-return-statements ) -> None: """operation sets one or more user-defined name-value pairs for the specified container. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 + :param comp: comp. "metadata" Required. + :type comp: str or ~azure.storage.blob.models.Enum12 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1222,26 +1248,23 @@ def set_metadata( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "metadata". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "metadata")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _if_modified_since = None @@ -1252,22 +1275,22 @@ def set_metadata( # pylint: disable=inconsistent-return-statements request = build_set_metadata_request( url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, timeout=timeout, lease_id=_lease_id, metadata=metadata, if_modified_since=_if_modified_since, request_id_parameter=request_id_parameter, - restype=restype, - comp=comp, - version=self._config.version, template_url=self.set_metadata.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1291,11 +1314,13 @@ def set_metadata( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_metadata.metadata = {"url": "{url}/{containerName}"} # type: ignore + set_metadata.metadata = {"url": "{url}/{containerName}"} @distributed_trace def get_access_policy( self, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum13], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -1304,6 +1329,10 @@ def get_access_policy( """gets the permissions for the specified container. The permissions indicate whether container data may be accessed publicly. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 + :param comp: comp. "acl" Required. + :type comp: str or ~azure.storage.blob.models.Enum13 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1315,26 +1344,23 @@ def get_access_policy( :type request_id_parameter: str :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "acl". Note that overriding this default value may result - in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of SignedIdentifier or the result of cls(response) :rtype: list[~azure.storage.blob.models.SignedIdentifier] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "acl")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.SignedIdentifier]] + cls: ClsType[List[_models.SignedIdentifier]] = kwargs.pop("cls", None) _lease_id = None if lease_access_conditions is not None: @@ -1342,20 +1368,20 @@ def get_access_policy( request = build_get_access_policy_request( url=self._config.url, - timeout=timeout, - lease_id=_lease_id, - request_id_parameter=request_id_parameter, restype=restype, comp=comp, version=self._config.version, + timeout=timeout, + lease_id=_lease_id, + request_id_parameter=request_id_parameter, template_url=self.get_access_policy.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1386,13 +1412,15 @@ def get_access_policy( return deserialized - get_access_policy.metadata = {"url": "{url}/{containerName}"} # type: ignore + get_access_policy.metadata = {"url": "{url}/{containerName}"} @distributed_trace def set_access_policy( # pylint: disable=inconsistent-return-statements self, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum13], timeout: Optional[int] = None, - access: Optional[Union[str, "_models.PublicAccessType"]] = None, + access: Optional[Union[str, _models.PublicAccessType]] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, @@ -1402,6 +1430,10 @@ def set_access_policy( # pylint: disable=inconsistent-return-statements """sets the permissions for the specified container. The permissions indicate whether blobs in a container may be accessed publicly. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 + :param comp: comp. "acl" Required. + :type comp: str or ~azure.storage.blob.models.Enum13 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1420,27 +1452,24 @@ def set_access_policy( # pylint: disable=inconsistent-return-statements :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param container_acl: the acls for the container. Default value is None. :type container_acl: list[~azure.storage.blob.models.SignedIdentifier] - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "acl". Note that overriding this default value may result - in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "acl")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _if_modified_since = None @@ -1460,25 +1489,25 @@ def set_access_policy( # pylint: disable=inconsistent-return-statements request = build_set_access_policy_request( url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, timeout=timeout, lease_id=_lease_id, access=access, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, - restype=restype, - comp=comp, content_type=content_type, - version=self._config.version, content=_content, template_url=self.set_access_policy.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1502,11 +1531,13 @@ def set_access_policy( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_access_policy.metadata = {"url": "{url}/{containerName}"} # type: ignore + set_access_policy.metadata = {"url": "{url}/{containerName}"} @distributed_trace def restore( # pylint: disable=inconsistent-return-statements self, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum14], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, deleted_container_name: Optional[str] = None, @@ -1515,6 +1546,10 @@ def restore( # pylint: disable=inconsistent-return-statements ) -> None: """Restores a previously-deleted container. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 + :param comp: comp. "undelete" Required. + :type comp: str or ~azure.storage.blob.models.Enum14 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1530,44 +1565,41 @@ def restore( # pylint: disable=inconsistent-return-statements :param deleted_container_version: Optional. Version 2019-12-12 and later. Specifies the version of the deleted container to restore. Default value is None. :type deleted_container_version: str - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "undelete". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "undelete")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_restore_request( url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, deleted_container_name=deleted_container_name, deleted_container_version=deleted_container_version, - restype=restype, - comp=comp, - version=self._config.version, template_url=self.restore.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1589,11 +1621,13 @@ def restore( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - restore.metadata = {"url": "{url}/{containerName}"} # type: ignore + restore.metadata = {"url": "{url}/{containerName}"} @distributed_trace def rename( # pylint: disable=inconsistent-return-statements self, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum15], source_container_name: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -1602,6 +1636,10 @@ def rename( # pylint: disable=inconsistent-return-statements ) -> None: """Renames an existing container. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 + :param comp: comp. "rename" Required. + :type comp: str or ~azure.storage.blob.models.Enum15 :param source_container_name: Required. Specifies the name of the container to rename. Required. :type source_container_name: str @@ -1617,44 +1655,41 @@ def rename( # pylint: disable=inconsistent-return-statements :param source_lease_id: A lease ID for the source path. If specified, the source path must have an active lease and the lease ID must match. Default value is None. :type source_lease_id: str - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "rename". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "rename")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_rename_request( url=self._config.url, + restype=restype, + comp=comp, source_container_name=source_container_name, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, source_lease_id=source_lease_id, - restype=restype, - comp=comp, - version=self._config.version, template_url=self.rename.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1676,11 +1711,13 @@ def rename( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - rename.metadata = {"url": "{url}/{containerName}"} # type: ignore + rename.metadata = {"url": "{url}/{containerName}"} @distributed_trace def submit_batch( self, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum9], content_length: int, body: IO, timeout: Optional[int] = None, @@ -1689,6 +1726,10 @@ def submit_batch( ) -> Iterator[bytes]: """The Batch operation allows multiple API calls to be embedded into a single HTTP request. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 + :param comp: comp. "batch" Required. + :type comp: str or ~azure.storage.blob.models.Enum9 :param content_length: The length of the request. Required. :type content_length: int :param body: Initial data. Required. @@ -1702,50 +1743,47 @@ def submit_batch( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "batch". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Iterator of the response bytes or the result of cls(response) :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "batch")) # type: str - multipart_content_type = kwargs.pop( + multipart_content_type: str = kwargs.pop( "multipart_content_type", _headers.pop("Content-Type", "application/xml") - ) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Iterator[bytes]] + ) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _content = body request = build_submit_batch_request( url=self._config.url, + restype=restype, + comp=comp, content_length=content_length, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, - restype=restype, - comp=comp, multipart_content_type=multipart_content_type, - version=self._config.version, content=_content, template_url=self.submit_batch.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=True, **kwargs ) @@ -1764,26 +1802,32 @@ def submit_batch( deserialized = response.stream_download(self._client._pipeline) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - submit_batch.metadata = {"url": "{url}/{containerName}"} # type: ignore + submit_batch.metadata = {"url": "{url}/{containerName}"} @distributed_trace def filter_blobs( self, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum10], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, where: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, "_models.FilterBlobsIncludeItem"]]] = None, + include: Optional[List[Union[str, _models.FilterBlobsIncludeItem]]] = None, **kwargs: Any ) -> _models.FilterBlobSegment: """The Filter Blobs operation enables callers to list blobs in a container whose tags match a given search expression. Filter blobs searches within the given container. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 + :param comp: comp. "blobs" Required. + :type comp: str or ~azure.storage.blob.models.Enum10 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1813,46 +1857,43 @@ def filter_blobs( :param include: Include this parameter to specify one or more datasets to include in the response. Default value is None. :type include: list[str or ~azure.storage.blob.models.FilterBlobsIncludeItem] - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "blobs". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FilterBlobSegment or the result of cls(response) :rtype: ~azure.storage.blob.models.FilterBlobSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "blobs")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.FilterBlobSegment] + cls: ClsType[_models.FilterBlobSegment] = kwargs.pop("cls", None) request = build_filter_blobs_request( url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, where=where, marker=marker, maxresults=maxresults, include=include, - restype=restype, - comp=comp, - version=self._config.version, template_url=self.filter_blobs.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1878,11 +1919,13 @@ def filter_blobs( return deserialized - filter_blobs.metadata = {"url": "{url}/{containerName}"} # type: ignore + filter_blobs.metadata = {"url": "{url}/{containerName}"} @distributed_trace def acquire_lease( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum16], + restype: Union[str, _models.Enum11], timeout: Optional[int] = None, duration: Optional[int] = None, proposed_lease_id: Optional[str] = None, @@ -1893,6 +1936,10 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements """[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + :param comp: comp. "lease" Required. + :type comp: str or ~azure.storage.blob.models.Enum16 + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1912,12 +1959,6 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "lease". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str :keyword action: Describes what lease action to take. Default value is "acquire". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1926,16 +1967,19 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -1945,24 +1989,24 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements request = build_acquire_lease_request( url=self._config.url, + comp=comp, + restype=restype, + version=self._config.version, timeout=timeout, duration=duration, proposed_lease_id=proposed_lease_id, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, - comp=comp, - restype=restype, action=action, - version=self._config.version, template_url=self.acquire_lease.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1987,11 +2031,13 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - acquire_lease.metadata = {"url": "{url}/{containerName}"} # type: ignore + acquire_lease.metadata = {"url": "{url}/{containerName}"} @distributed_trace def release_lease( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum16], + restype: Union[str, _models.Enum11], lease_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -2001,6 +2047,10 @@ def release_lease( # pylint: disable=inconsistent-return-statements """[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + :param comp: comp. "lease" Required. + :type comp: str or ~azure.storage.blob.models.Enum16 + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -2014,12 +2064,6 @@ def release_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "lease". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str :keyword action: Describes what lease action to take. Default value is "release". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -2028,16 +2072,19 @@ def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -2047,23 +2094,23 @@ def release_lease( # pylint: disable=inconsistent-return-statements request = build_release_lease_request( url=self._config.url, + comp=comp, + restype=restype, lease_id=lease_id, + version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, - comp=comp, - restype=restype, action=action, - version=self._config.version, template_url=self.release_lease.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2087,11 +2134,13 @@ def release_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - release_lease.metadata = {"url": "{url}/{containerName}"} # type: ignore + release_lease.metadata = {"url": "{url}/{containerName}"} @distributed_trace def renew_lease( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum16], + restype: Union[str, _models.Enum11], lease_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -2101,6 +2150,10 @@ def renew_lease( # pylint: disable=inconsistent-return-statements """[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + :param comp: comp. "lease" Required. + :type comp: str or ~azure.storage.blob.models.Enum16 + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -2114,12 +2167,6 @@ def renew_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "lease". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str :keyword action: Describes what lease action to take. Default value is "renew". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -2128,16 +2175,19 @@ def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -2147,23 +2197,23 @@ def renew_lease( # pylint: disable=inconsistent-return-statements request = build_renew_lease_request( url=self._config.url, + comp=comp, + restype=restype, lease_id=lease_id, + version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, - comp=comp, - restype=restype, action=action, - version=self._config.version, template_url=self.renew_lease.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2188,11 +2238,13 @@ def renew_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - renew_lease.metadata = {"url": "{url}/{containerName}"} # type: ignore + renew_lease.metadata = {"url": "{url}/{containerName}"} @distributed_trace def break_lease( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum16], + restype: Union[str, _models.Enum11], timeout: Optional[int] = None, break_period: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -2202,6 +2254,10 @@ def break_lease( # pylint: disable=inconsistent-return-statements """[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + :param comp: comp. "lease" Required. + :type comp: str or ~azure.storage.blob.models.Enum16 + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -2221,12 +2277,6 @@ def break_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "lease". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str :keyword action: Describes what lease action to take. Default value is "break". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -2235,16 +2285,19 @@ def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -2254,23 +2307,23 @@ def break_lease( # pylint: disable=inconsistent-return-statements request = build_break_lease_request( url=self._config.url, + comp=comp, + restype=restype, + version=self._config.version, timeout=timeout, break_period=break_period, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, - comp=comp, - restype=restype, action=action, - version=self._config.version, template_url=self.break_lease.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2295,11 +2348,13 @@ def break_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - break_lease.metadata = {"url": "{url}/{containerName}"} # type: ignore + break_lease.metadata = {"url": "{url}/{containerName}"} @distributed_trace def change_lease( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum16], + restype: Union[str, _models.Enum11], lease_id: str, proposed_lease_id: str, timeout: Optional[int] = None, @@ -2310,6 +2365,10 @@ def change_lease( # pylint: disable=inconsistent-return-statements """[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + :param comp: comp. "lease" Required. + :type comp: str or ~azure.storage.blob.models.Enum16 + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param proposed_lease_id: Proposed lease ID, in a GUID string format. The Blob service returns @@ -2327,12 +2386,6 @@ def change_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "lease". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str :keyword action: Describes what lease action to take. Default value is "change". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -2341,16 +2394,19 @@ def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -2360,24 +2416,24 @@ def change_lease( # pylint: disable=inconsistent-return-statements request = build_change_lease_request( url=self._config.url, + comp=comp, + restype=restype, lease_id=lease_id, proposed_lease_id=proposed_lease_id, + version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, - comp=comp, - restype=restype, action=action, - version=self._config.version, template_url=self.change_lease.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2402,21 +2458,27 @@ def change_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - change_lease.metadata = {"url": "{url}/{containerName}"} # type: ignore + change_lease.metadata = {"url": "{url}/{containerName}"} @distributed_trace def list_blob_flat_segment( self, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum5], prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, "_models.ListBlobsIncludeItem"]]] = None, + include: Optional[List[Union[str, _models.ListBlobsIncludeItem]]] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> _models.ListBlobsFlatSegmentResponse: """[Update] The List Blobs operation returns a list of the blobs under the specified container. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 + :param comp: comp. "list" Required. + :type comp: str or ~azure.storage.blob.models.Enum5 :param prefix: Filters the results to return only containers whose name begins with the specified prefix. Default value is None. :type prefix: str @@ -2446,46 +2508,43 @@ def list_blob_flat_segment( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "list". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListBlobsFlatSegmentResponse or the result of cls(response) :rtype: ~azure.storage.blob.models.ListBlobsFlatSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "list")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListBlobsFlatSegmentResponse] + cls: ClsType[_models.ListBlobsFlatSegmentResponse] = kwargs.pop("cls", None) request = build_list_blob_flat_segment_request( url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, prefix=prefix, marker=marker, maxresults=maxresults, include=include, timeout=timeout, request_id_parameter=request_id_parameter, - restype=restype, - comp=comp, - version=self._config.version, template_url=self.list_blob_flat_segment.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2512,22 +2571,28 @@ def list_blob_flat_segment( return deserialized - list_blob_flat_segment.metadata = {"url": "{url}/{containerName}"} # type: ignore + list_blob_flat_segment.metadata = {"url": "{url}/{containerName}"} @distributed_trace def list_blob_hierarchy_segment( self, + restype: Union[str, _models.Enum11], + comp: Union[str, _models.Enum5], delimiter: str, prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, "_models.ListBlobsIncludeItem"]]] = None, + include: Optional[List[Union[str, _models.ListBlobsIncludeItem]]] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> _models.ListBlobsHierarchySegmentResponse: """[Update] The List Blobs operation returns a list of the blobs under the specified container. + :param restype: restype. "container" Required. + :type restype: str or ~azure.storage.blob.models.Enum11 + :param comp: comp. "list" Required. + :type comp: str or ~azure.storage.blob.models.Enum5 :param delimiter: When the request includes this parameter, the operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may be a @@ -2562,47 +2627,44 @@ def list_blob_hierarchy_segment( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword restype: restype. Default value is "container". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "list". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListBlobsHierarchySegmentResponse or the result of cls(response) :rtype: ~azure.storage.blob.models.ListBlobsHierarchySegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "list")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListBlobsHierarchySegmentResponse] + cls: ClsType[_models.ListBlobsHierarchySegmentResponse] = kwargs.pop("cls", None) request = build_list_blob_hierarchy_segment_request( url=self._config.url, + restype=restype, + comp=comp, delimiter=delimiter, + version=self._config.version, prefix=prefix, marker=marker, maxresults=maxresults, include=include, timeout=timeout, request_id_parameter=request_id_parameter, - restype=restype, - comp=comp, - version=self._config.version, template_url=self.list_blob_hierarchy_segment.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2629,32 +2691,35 @@ def list_blob_hierarchy_segment( return deserialized - list_blob_hierarchy_segment.metadata = {"url": "{url}/{containerName}"} # type: ignore + list_blob_hierarchy_segment.metadata = {"url": "{url}/{containerName}"} @distributed_trace - def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + def get_account_info( # pylint: disable=inconsistent-return-statements + self, restype: Union[str, _models.Enum8], comp: Union[str, _models.Enum1], **kwargs: Any + ) -> None: """Returns the sku name and account kind. - :keyword restype: restype. Default value is "account". Note that overriding this default value - may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "properties". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str + :param restype: restype. "account" Required. + :type restype: str or ~azure.storage.blob.models.Enum8 + :param comp: comp. "properties" Required. + :type comp: str or ~azure.storage.blob.models.Enum1 :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "account")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_get_account_info_request( url=self._config.url, @@ -2666,9 +2731,9 @@ def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsiste 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2692,4 +2757,4 @@ def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsiste if cls: return cls(pipeline_response, None, response_headers) - get_account_info.metadata = {"url": "{url}/{containerName}"} # type: ignore + get_account_info.metadata = {"url": "{url}/{containerName}"} diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py index ad6e0b2f3c8c..23ed0d6188b2 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py @@ -7,6 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -14,6 +15,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -26,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,8 +44,9 @@ def build_create_request( *, content_length: int, blob_content_length: int, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, - tier: Optional[Union[str, "_models.PremiumPageBlobAccessTier"]] = None, + tier: Optional[Union[str, _models.PremiumPageBlobAccessTier]] = None, blob_content_type: Optional[str] = None, blob_content_encoding: Optional[str] = None, blob_content_language: Optional[str] = None, @@ -50,7 +57,7 @@ def build_create_request( blob_content_disposition: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, + encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, encryption_scope: Optional[str] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -61,15 +68,14 @@ def build_create_request( request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, + immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, legal_hold: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "PageBlob")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + blob_type: Literal["PageBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "PageBlob")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -78,7 +84,7 @@ def build_create_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters if timeout is not None: @@ -157,8 +163,10 @@ def build_create_request( def build_upload_pages_request( url: str, *, + comp: Union[str, _models.Enum34], content_length: int, content: IO, + version: Union[str, _models.Enum2], transactional_content_md5: Optional[bytes] = None, transactional_content_crc64: Optional[bytes] = None, timeout: Optional[int] = None, @@ -166,7 +174,7 @@ def build_upload_pages_request( lease_id: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, + encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, encryption_scope: Optional[str] = None, if_sequence_number_less_than_or_equal_to: Optional[int] = None, if_sequence_number_less_than: Optional[int] = None, @@ -182,10 +190,8 @@ def build_upload_pages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "page")) # type: str - page_write = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -194,7 +200,7 @@ def build_upload_pages_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -261,13 +267,15 @@ def build_upload_pages_request( def build_clear_pages_request( url: str, *, + comp: Union[str, _models.Enum34], content_length: int, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, range: Optional[str] = None, lease_id: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, + encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, encryption_scope: Optional[str] = None, if_sequence_number_less_than_or_equal_to: Optional[int] = None, if_sequence_number_less_than: Optional[int] = None, @@ -283,9 +291,7 @@ def build_clear_pages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "page")) # type: str - page_write = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "clear")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + page_write: Literal["clear"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "clear")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -294,7 +300,7 @@ def build_clear_pages_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -351,16 +357,18 @@ def build_clear_pages_request( def build_upload_pages_from_url_request( url: str, *, + comp: Union[str, _models.Enum34], source_url: str, source_range: str, content_length: int, range: str, + version: Union[str, _models.Enum2], source_content_md5: Optional[bytes] = None, source_contentcrc64: Optional[bytes] = None, timeout: Optional[int] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, + encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, encryption_scope: Optional[str] = None, lease_id: Optional[str] = None, if_sequence_number_less_than_or_equal_to: Optional[int] = None, @@ -382,9 +390,7 @@ def build_upload_pages_from_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "page")) # type: str - page_write = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -393,7 +399,7 @@ def build_upload_pages_from_url_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -473,6 +479,8 @@ def build_upload_pages_from_url_request( def build_get_page_ranges_request( url: str, *, + comp: Union[str, _models.Enum35], + version: Union[str, _models.Enum2], snapshot: Optional[str] = None, timeout: Optional[int] = None, range: Optional[str] = None, @@ -490,8 +498,6 @@ def build_get_page_ranges_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "pagelist")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -500,7 +506,7 @@ def build_get_page_ranges_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -539,6 +545,8 @@ def build_get_page_ranges_request( def build_get_page_ranges_diff_request( url: str, *, + comp: Union[str, _models.Enum35], + version: Union[str, _models.Enum2], snapshot: Optional[str] = None, timeout: Optional[int] = None, prevsnapshot: Optional[str] = None, @@ -558,8 +566,6 @@ def build_get_page_ranges_diff_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "pagelist")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -568,7 +574,7 @@ def build_get_page_ranges_diff_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -611,12 +617,14 @@ def build_get_page_ranges_diff_request( def build_resize_request( url: str, *, + comp: Union[str, _models.Enum1], blob_content_length: int, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, lease_id: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, + encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, encryption_scope: Optional[str] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -629,8 +637,6 @@ def build_resize_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -639,7 +645,7 @@ def build_resize_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -681,7 +687,9 @@ def build_resize_request( def build_update_sequence_number_request( url: str, *, - sequence_number_action: Union[str, "_models.SequenceNumberActionType"], + comp: Union[str, _models.Enum1], + sequence_number_action: Union[str, _models.SequenceNumberActionType], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, lease_id: Optional[str] = None, if_modified_since: Optional[datetime.datetime] = None, @@ -696,8 +704,6 @@ def build_update_sequence_number_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -706,7 +712,7 @@ def build_update_sequence_number_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -742,7 +748,9 @@ def build_update_sequence_number_request( def build_copy_incremental_request( url: str, *, + comp: Union[str, _models.Enum36], copy_source: str, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -755,8 +763,6 @@ def build_copy_incremental_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "incrementalcopy")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -765,7 +771,7 @@ def build_copy_incremental_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -817,13 +823,13 @@ def create( # pylint: disable=inconsistent-return-statements content_length: int, blob_content_length: int, timeout: Optional[int] = None, - tier: Optional[Union[str, "_models.PremiumPageBlobAccessTier"]] = None, + tier: Optional[Union[str, _models.PremiumPageBlobAccessTier]] = None, metadata: Optional[Dict[str, str]] = None, blob_sequence_number: int = 0, request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, + immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, legal_hold: Optional[bool] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -893,14 +899,19 @@ def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 = kwargs.pop("params", {}) or {} - blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "PageBlob")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + blob_type: Literal["PageBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "PageBlob")) + cls: ClsType[None] = kwargs.pop("cls", None) _blob_content_type = None _blob_content_encoding = None @@ -944,6 +955,7 @@ def create( # pylint: disable=inconsistent-return-statements url=self._config.url, content_length=content_length, blob_content_length=blob_content_length, + version=self._config.version, timeout=timeout, tier=tier, blob_content_type=_blob_content_type, @@ -970,15 +982,14 @@ def create( # pylint: disable=inconsistent-return-statements immutability_policy_mode=immutability_policy_mode, legal_hold=legal_hold, blob_type=blob_type, - version=self._config.version, template_url=self.create.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1013,11 +1024,12 @@ def create( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + create.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def upload_pages( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum34], content_length: int, body: IO, transactional_content_md5: Optional[bytes] = None, @@ -1034,6 +1046,8 @@ def upload_pages( # pylint: disable=inconsistent-return-statements ) -> None: """The Upload Pages operation writes a range of pages to a page blob. + :param comp: comp. "page" Required. + :type comp: str or ~azure.storage.blob.models.Enum34 :param content_length: The length of the request. Required. :type content_length: int :param body: Initial data. Required. @@ -1066,9 +1080,6 @@ def upload_pages( # pylint: disable=inconsistent-return-statements ~azure.storage.blob.models.SequenceNumberAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "page". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword page_write: Required. You may specify one of the following options: @@ -1084,16 +1095,20 @@ def upload_pages( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "page")) # type: str - page_write = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _encryption_key = None @@ -1132,7 +1147,9 @@ def upload_pages( # pylint: disable=inconsistent-return-statements request = build_upload_pages_request( url=self._config.url, + comp=comp, content_length=content_length, + version=self._config.version, transactional_content_md5=transactional_content_md5, transactional_content_crc64=transactional_content_crc64, timeout=timeout, @@ -1151,19 +1168,17 @@ def upload_pages( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, page_write=page_write, content_type=content_type, - version=self._config.version, content=_content, template_url=self.upload_pages.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1203,11 +1218,12 @@ def upload_pages( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - upload_pages.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + upload_pages.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def clear_pages( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum34], content_length: int, timeout: Optional[int] = None, range: Optional[str] = None, @@ -1221,6 +1237,8 @@ def clear_pages( # pylint: disable=inconsistent-return-statements ) -> None: """The Clear Pages operation clears a set of pages from a page blob. + :param comp: comp. "page" Required. + :type comp: str or ~azure.storage.blob.models.Enum34 :param content_length: The length of the request. Required. :type content_length: int :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -1245,9 +1263,6 @@ def clear_pages( # pylint: disable=inconsistent-return-statements ~azure.storage.blob.models.SequenceNumberAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "page". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword page_write: Required. You may specify one of the following options: @@ -1263,15 +1278,19 @@ def clear_pages( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "page")) # type: str - page_write = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "clear")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + page_write: Literal["clear"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "clear")) + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _encryption_key = None @@ -1309,7 +1328,9 @@ def clear_pages( # pylint: disable=inconsistent-return-statements request = build_clear_pages_request( url=self._config.url, + comp=comp, content_length=content_length, + version=self._config.version, timeout=timeout, range=range, lease_id=_lease_id, @@ -1326,17 +1347,15 @@ def clear_pages( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, page_write=page_write, - version=self._config.version, template_url=self.clear_pages.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1367,11 +1386,12 @@ def clear_pages( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - clear_pages.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + clear_pages.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def upload_pages_from_url( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum34], source_url: str, source_range: str, content_length: int, @@ -1392,6 +1412,8 @@ def upload_pages_from_url( # pylint: disable=inconsistent-return-statements """The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL. + :param comp: comp. "page" Required. + :type comp: str or ~azure.storage.blob.models.Enum34 :param source_url: Specify a URL to the copy source. Required. :type source_url: str :param source_range: Bytes of source data in the specified range. The length of this range @@ -1434,9 +1456,6 @@ def upload_pages_from_url( # pylint: disable=inconsistent-return-statements :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions - :keyword comp: comp. Default value is "page". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword page_write: Required. You may specify one of the following options: @@ -1452,15 +1471,19 @@ def upload_pages_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "page")) # type: str - page_write = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) + cls: ClsType[None] = kwargs.pop("cls", None) _encryption_key = None _encryption_key_sha256 = None @@ -1507,10 +1530,12 @@ def upload_pages_from_url( # pylint: disable=inconsistent-return-statements request = build_upload_pages_from_url_request( url=self._config.url, + comp=comp, source_url=source_url, source_range=source_range, content_length=content_length, range=range, + version=self._config.version, source_content_md5=source_content_md5, source_contentcrc64=source_contentcrc64, timeout=timeout, @@ -1533,17 +1558,15 @@ def upload_pages_from_url( # pylint: disable=inconsistent-return-statements source_if_none_match=_source_if_none_match, request_id_parameter=request_id_parameter, copy_source_authorization=copy_source_authorization, - comp=comp, page_write=page_write, - version=self._config.version, template_url=self.upload_pages_from_url.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1580,11 +1603,12 @@ def upload_pages_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - upload_pages_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + upload_pages_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def get_page_ranges( self, + comp: Union[str, _models.Enum35], snapshot: Optional[str] = None, timeout: Optional[int] = None, range: Optional[str] = None, @@ -1598,6 +1622,8 @@ def get_page_ranges( """The Get Page Ranges operation returns the list of valid page ranges for a page blob or snapshot of a page blob. + :param comp: comp. "pagelist" Required. + :type comp: str or ~azure.storage.blob.models.Enum35 :param snapshot: The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:` None: """Resize the Blob. + :param comp: comp. "properties" Required. + :type comp: str or ~azure.storage.blob.models.Enum1 :param blob_content_length: This header specifies the maximum size for the page blob, up to 1 TB. The page blob size must be aligned to a 512-byte boundary. Required. :type blob_content_length: int @@ -1910,22 +1944,23 @@ def resize( # pylint: disable=inconsistent-return-statements :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "properties". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _encryption_key = None @@ -1954,7 +1989,9 @@ def resize( # pylint: disable=inconsistent-return-statements request = build_resize_request( url=self._config.url, + comp=comp, blob_content_length=blob_content_length, + version=self._config.version, timeout=timeout, lease_id=_lease_id, encryption_key=_encryption_key, @@ -1967,16 +2004,14 @@ def resize( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, - version=self._config.version, template_url=self.resize.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2003,12 +2038,13 @@ def resize( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - resize.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + resize.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def update_sequence_number( # pylint: disable=inconsistent-return-statements self, - sequence_number_action: Union[str, "_models.SequenceNumberActionType"], + comp: Union[str, _models.Enum1], + sequence_number_action: Union[str, _models.SequenceNumberActionType], timeout: Optional[int] = None, blob_sequence_number: int = 0, request_id_parameter: Optional[str] = None, @@ -2018,6 +2054,8 @@ def update_sequence_number( # pylint: disable=inconsistent-return-statements ) -> None: """Update the sequence number of the blob. + :param comp: comp. "properties" Required. + :type comp: str or ~azure.storage.blob.models.Enum1 :param sequence_number_action: Required if the x-ms-blob-sequence-number header is set for the request. This property applies to page blobs only. This property indicates how the service should modify the blob's sequence number. Known values are: "max", "update", and "increment". @@ -2040,22 +2078,23 @@ def update_sequence_number( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "properties". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None _if_modified_since = None @@ -2074,7 +2113,9 @@ def update_sequence_number( # pylint: disable=inconsistent-return-statements request = build_update_sequence_number_request( url=self._config.url, + comp=comp, sequence_number_action=sequence_number_action, + version=self._config.version, timeout=timeout, lease_id=_lease_id, if_modified_since=_if_modified_since, @@ -2084,16 +2125,14 @@ def update_sequence_number( # pylint: disable=inconsistent-return-statements if_tags=_if_tags, blob_sequence_number=blob_sequence_number, request_id_parameter=request_id_parameter, - comp=comp, - version=self._config.version, template_url=self.update_sequence_number.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2120,11 +2159,12 @@ def update_sequence_number( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - update_sequence_number.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + update_sequence_number.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace def copy_incremental( # pylint: disable=inconsistent-return-statements self, + comp: Union[str, _models.Enum36], copy_source: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -2137,6 +2177,8 @@ def copy_incremental( # pylint: disable=inconsistent-return-statements the original snapshot and can be read or copied from as usual. This API is supported since REST version 2016-05-31. + :param comp: comp. "incrementalcopy" Required. + :type comp: str or ~azure.storage.blob.models.Enum36 :param copy_source: Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated @@ -2153,22 +2195,23 @@ def copy_incremental( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. Default value is "incrementalcopy". Note that overriding this default - value may result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "incrementalcopy")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None _if_unmodified_since = None @@ -2184,7 +2227,9 @@ def copy_incremental( # pylint: disable=inconsistent-return-statements request = build_copy_incremental_request( url=self._config.url, + comp=comp, copy_source=copy_source, + version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, @@ -2192,16 +2237,14 @@ def copy_incremental( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, - comp=comp, - version=self._config.version, template_url=self.copy_incremental.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2227,4 +2270,4 @@ def copy_incremental( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - copy_incremental.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore + copy_incremental.metadata = {"url": "{url}/{containerName}/{blob}"} diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py index 75e0f8a8f2f9..3fac19e02614 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py @@ -13,6 +13,7 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, + ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -33,15 +34,20 @@ def build_set_properties_request( - url: str, *, content: Any, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + url: str, + *, + restype: Union[str, _models.Enum0], + comp: Union[str, _models.Enum1], + content: Any, + version: Union[str, _models.Enum2], + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -50,7 +56,7 @@ def build_set_properties_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -70,14 +76,18 @@ def build_set_properties_request( def build_get_properties_request( - url: str, *, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + url: str, + *, + restype: Union[str, _models.Enum0], + comp: Union[str, _models.Enum1], + version: Union[str, _models.Enum2], + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -86,7 +96,7 @@ def build_get_properties_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -104,14 +114,18 @@ def build_get_properties_request( def build_get_statistics_request( - url: str, *, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + url: str, + *, + restype: Union[str, _models.Enum0], + comp: Union[str, _models.Enum3], + version: Union[str, _models.Enum2], + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "stats")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -120,7 +134,7 @@ def build_get_statistics_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -140,10 +154,12 @@ def build_get_statistics_request( def build_list_containers_segment_request( url: str, *, + comp: Union[str, _models.Enum5], + version: Union[str, _models.Enum2], prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, "_models.ListContainersIncludeType"]]] = None, + include: Optional[List[Union[str, _models.ListContainersIncludeType]]] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any @@ -151,8 +167,6 @@ def build_list_containers_segment_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "list")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -161,7 +175,7 @@ def build_list_containers_segment_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -186,15 +200,20 @@ def build_list_containers_segment_request( def build_get_user_delegation_key_request( - url: str, *, content: Any, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + url: str, + *, + restype: Union[str, _models.Enum0], + comp: Union[str, _models.Enum7], + content: Any, + version: Union[str, _models.Enum2], + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "userdelegationkey")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -203,7 +222,7 @@ def build_get_user_delegation_key_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -222,13 +241,17 @@ def build_get_user_delegation_key_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, content=content, **kwargs) -def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: +def build_get_account_info_request( + url: str, + *, + restype: Union[str, _models.Enum8], + comp: Union[str, _models.Enum1], + version: Union[str, _models.Enum2], + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype = kwargs.pop("restype", _params.pop("restype", "account")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -237,7 +260,7 @@ def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -253,8 +276,10 @@ def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: def build_submit_batch_request( url: str, *, + comp: Union[str, _models.Enum9], content_length: int, content: IO, + version: Union[str, _models.Enum2], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any @@ -262,11 +287,7 @@ def build_submit_batch_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "batch")) # type: str - multipart_content_type = kwargs.pop( - "multipart_content_type", _headers.pop("Content-Type", None) - ) # type: Optional[str] - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str + multipart_content_type: Optional[str] = kwargs.pop("multipart_content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -275,7 +296,7 @@ def build_submit_batch_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -297,19 +318,19 @@ def build_submit_batch_request( def build_filter_blobs_request( url: str, *, + comp: Union[str, _models.Enum10], + version: Union[str, _models.Enum2], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, where: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, "_models.FilterBlobsIncludeItem"]]] = None, + include: Optional[List[Union[str, _models.FilterBlobsIncludeItem]]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop("comp", _params.pop("comp", "blobs")) # type: str - version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -318,7 +339,7 @@ def build_filter_blobs_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -364,6 +385,8 @@ def __init__(self, *args, **kwargs): @distributed_trace def set_properties( # pylint: disable=inconsistent-return-statements self, + restype: Union[str, _models.Enum0], + comp: Union[str, _models.Enum1], storage_service_properties: _models.StorageServiceProperties, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -372,6 +395,10 @@ def set_properties( # pylint: disable=inconsistent-return-statements """Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + :param restype: restype. "service" Required. + :type restype: str or ~azure.storage.blob.models.Enum0 + :param comp: comp. "properties" Required. + :type comp: str or ~azure.storage.blob.models.Enum1 :param storage_service_properties: The StorageService properties. Required. :type storage_service_properties: ~azure.storage.blob.models.StorageServiceProperties :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -383,47 +410,44 @@ def set_properties( # pylint: disable=inconsistent-return-statements limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword restype: restype. Default value is "service". Note that overriding this default value - may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "properties". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) + cls: ClsType[None] = kwargs.pop("cls", None) _content = self._serialize.body(storage_service_properties, "StorageServiceProperties", is_xml=True) request = build_set_properties_request( url=self._config.url, - timeout=timeout, - request_id_parameter=request_id_parameter, restype=restype, comp=comp, - content_type=content_type, version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + content_type=content_type, content=_content, template_url=self.set_properties.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -444,15 +468,24 @@ def set_properties( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_properties.metadata = {"url": "{url}"} # type: ignore + set_properties.metadata = {"url": "{url}"} @distributed_trace def get_properties( - self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + self, + restype: Union[str, _models.Enum0], + comp: Union[str, _models.Enum1], + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + **kwargs: Any ) -> _models.StorageServiceProperties: """gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + :param restype: restype. "service" Required. + :type restype: str or ~azure.storage.blob.models.Enum0 + :param comp: comp. "properties" Required. + :type comp: str or ~azure.storage.blob.models.Enum1 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -462,42 +495,39 @@ def get_properties( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword restype: restype. Default value is "service". Note that overriding this default value - may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "properties". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceProperties or the result of cls(response) :rtype: ~azure.storage.blob.models.StorageServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageServiceProperties] + cls: ClsType[_models.StorageServiceProperties] = kwargs.pop("cls", None) request = build_get_properties_request( url=self._config.url, - timeout=timeout, - request_id_parameter=request_id_parameter, restype=restype, comp=comp, version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, template_url=self.get_properties.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -522,16 +552,25 @@ def get_properties( return deserialized - get_properties.metadata = {"url": "{url}"} # type: ignore + get_properties.metadata = {"url": "{url}"} @distributed_trace def get_statistics( - self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + self, + restype: Union[str, _models.Enum0], + comp: Union[str, _models.Enum3], + timeout: Optional[int] = None, + request_id_parameter: Optional[str] = None, + **kwargs: Any ) -> _models.StorageServiceStats: """Retrieves statistics related to replication for the Blob service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account. + :param restype: restype. "service" Required. + :type restype: str or ~azure.storage.blob.models.Enum0 + :param comp: comp. "stats" Required. + :type comp: str or ~azure.storage.blob.models.Enum3 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -541,42 +580,39 @@ def get_statistics( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword restype: restype. Default value is "service". Note that overriding this default value - may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "stats". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceStats or the result of cls(response) :rtype: ~azure.storage.blob.models.StorageServiceStats :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "stats")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageServiceStats] + cls: ClsType[_models.StorageServiceStats] = kwargs.pop("cls", None) request = build_get_statistics_request( url=self._config.url, - timeout=timeout, - request_id_parameter=request_id_parameter, restype=restype, comp=comp, version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, template_url=self.get_statistics.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -602,15 +638,16 @@ def get_statistics( return deserialized - get_statistics.metadata = {"url": "{url}"} # type: ignore + get_statistics.metadata = {"url": "{url}"} @distributed_trace def list_containers_segment( self, + comp: Union[str, _models.Enum5], prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, "_models.ListContainersIncludeType"]]] = None, + include: Optional[List[Union[str, _models.ListContainersIncludeType]]] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any @@ -618,6 +655,8 @@ def list_containers_segment( """The List Containers Segment operation returns a list of the containers under the specified account. + :param comp: comp. "list" Required. + :type comp: str or ~azure.storage.blob.models.Enum5 :param prefix: Filters the results to return only containers whose name begins with the specified prefix. Default value is None. :type prefix: str @@ -647,41 +686,42 @@ def list_containers_segment( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword comp: comp. Default value is "list". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListContainersSegmentResponse or the result of cls(response) :rtype: ~azure.storage.blob.models.ListContainersSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "list")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListContainersSegmentResponse] + cls: ClsType[_models.ListContainersSegmentResponse] = kwargs.pop("cls", None) request = build_list_containers_segment_request( url=self._config.url, + comp=comp, + version=self._config.version, prefix=prefix, marker=marker, maxresults=maxresults, include=include, timeout=timeout, request_id_parameter=request_id_parameter, - comp=comp, - version=self._config.version, template_url=self.list_containers_segment.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -706,11 +746,13 @@ def list_containers_segment( return deserialized - list_containers_segment.metadata = {"url": "{url}"} # type: ignore + list_containers_segment.metadata = {"url": "{url}"} @distributed_trace def get_user_delegation_key( self, + restype: Union[str, _models.Enum0], + comp: Union[str, _models.Enum7], key_info: _models.KeyInfo, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -719,6 +761,10 @@ def get_user_delegation_key( """Retrieves a user delegation key for the Blob service. This is only a valid operation when using bearer token authentication. + :param restype: restype. "service" Required. + :type restype: str or ~azure.storage.blob.models.Enum0 + :param comp: comp. "userdelegationkey" Required. + :type comp: str or ~azure.storage.blob.models.Enum7 :param key_info: Key information. Required. :type key_info: ~azure.storage.blob.models.KeyInfo :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -730,47 +776,44 @@ def get_user_delegation_key( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword restype: restype. Default value is "service". Note that overriding this default value - may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "userdelegationkey". Note that overriding this default - value may result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: UserDelegationKey or the result of cls(response) :rtype: ~azure.storage.blob.models.UserDelegationKey :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "userdelegationkey")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.UserDelegationKey] + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) + cls: ClsType[_models.UserDelegationKey] = kwargs.pop("cls", None) _content = self._serialize.body(key_info, "KeyInfo", is_xml=True) request = build_get_user_delegation_key_request( url=self._config.url, - timeout=timeout, - request_id_parameter=request_id_parameter, restype=restype, comp=comp, - content_type=content_type, version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + content_type=content_type, content=_content, template_url=self.get_user_delegation_key.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -796,32 +839,35 @@ def get_user_delegation_key( return deserialized - get_user_delegation_key.metadata = {"url": "{url}"} # type: ignore + get_user_delegation_key.metadata = {"url": "{url}"} @distributed_trace - def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + def get_account_info( # pylint: disable=inconsistent-return-statements + self, restype: Union[str, _models.Enum8], comp: Union[str, _models.Enum1], **kwargs: Any + ) -> None: """Returns the sku name and account kind. - :keyword restype: restype. Default value is "account". Note that overriding this default value - may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. Default value is "properties". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str + :param restype: restype. "account" Required. + :type restype: str or ~azure.storage.blob.models.Enum8 + :param comp: comp. "properties" Required. + :type comp: str or ~azure.storage.blob.models.Enum1 :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - restype = kwargs.pop("restype", _params.pop("restype", "account")) # type: str - comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + cls: ClsType[None] = kwargs.pop("cls", None) request = build_get_account_info_request( url=self._config.url, @@ -833,9 +879,9 @@ def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsiste 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -860,11 +906,12 @@ def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsiste if cls: return cls(pipeline_response, None, response_headers) - get_account_info.metadata = {"url": "{url}"} # type: ignore + get_account_info.metadata = {"url": "{url}"} @distributed_trace def submit_batch( self, + comp: Union[str, _models.Enum9], content_length: int, body: IO, timeout: Optional[int] = None, @@ -873,6 +920,8 @@ def submit_batch( ) -> Iterator[bytes]: """The Batch operation allows multiple API calls to be embedded into a single HTTP request. + :param comp: comp. "batch" Required. + :type comp: str or ~azure.storage.blob.models.Enum9 :param content_length: The length of the request. Required. :type content_length: int :param body: Initial data. Required. @@ -886,45 +935,46 @@ def submit_batch( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str - :keyword comp: comp. Default value is "batch". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Iterator of the response bytes or the result of cls(response) :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "batch")) # type: str - multipart_content_type = kwargs.pop( + multipart_content_type: str = kwargs.pop( "multipart_content_type", _headers.pop("Content-Type", "application/xml") - ) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Iterator[bytes]] + ) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _content = body request = build_submit_batch_request( url=self._config.url, + comp=comp, content_length=content_length, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, - comp=comp, multipart_content_type=multipart_content_type, - version=self._config.version, content=_content, template_url=self.submit_batch.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=True, **kwargs ) @@ -943,27 +993,30 @@ def submit_batch( deserialized = response.stream_download(self._client._pipeline) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore - submit_batch.metadata = {"url": "{url}"} # type: ignore + submit_batch.metadata = {"url": "{url}"} @distributed_trace def filter_blobs( self, + comp: Union[str, _models.Enum10], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, where: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, "_models.FilterBlobsIncludeItem"]]] = None, + include: Optional[List[Union[str, _models.FilterBlobsIncludeItem]]] = None, **kwargs: Any ) -> _models.FilterBlobSegment: """The Filter Blobs operation enables callers to list blobs across all containers whose tags match a given search expression. Filter blobs searches across all containers within a storage account but can be scoped within the expression to a single container. + :param comp: comp. "blobs" Required. + :type comp: str or ~azure.storage.blob.models.Enum10 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -993,41 +1046,42 @@ def filter_blobs( :param include: Include this parameter to specify one or more datasets to include in the response. Default value is None. :type include: list[str or ~azure.storage.blob.models.FilterBlobsIncludeItem] - :keyword comp: comp. Default value is "blobs". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FilterBlobSegment or the result of cls(response) :rtype: ~azure.storage.blob.models.FilterBlobSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} + 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 {}) + _params = kwargs.pop("params", {}) or {} - comp = kwargs.pop("comp", _params.pop("comp", "blobs")) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.FilterBlobSegment] + cls: ClsType[_models.FilterBlobSegment] = kwargs.pop("cls", None) request = build_filter_blobs_request( url=self._config.url, + comp=comp, + version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, where=where, marker=marker, maxresults=maxresults, include=include, - comp=comp, - version=self._config.version, template_url=self.filter_blobs.metadata["url"], headers=_headers, 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 + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1053,4 +1107,4 @@ def filter_blobs( return deserialized - filter_blobs.metadata = {"url": "{url}"} # type: ignore + filter_blobs.metadata = {"url": "{url}"} From 8e01b02cb1db01a7a6247dc3b44ca5bfac429f8b Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Tue, 14 Feb 2023 16:49:04 -0800 Subject: [PATCH 2/5] Regenerate on swagger, add in modelerfour fix --- .../blob/_generated/_azure_blob_storage.py | 12 +- .../storage/blob/_generated/_configuration.py | 20 +- .../_generated/aio/_azure_blob_storage.py | 12 +- .../blob/_generated/aio/_configuration.py | 20 +- .../aio/operations/_append_blob_operations.py | 41 +- .../aio/operations/_blob_operations.py | 306 +++++------ .../aio/operations/_block_blob_operations.py | 56 ++- .../aio/operations/_container_operations.py | 365 ++++++++------ .../aio/operations/_page_blob_operations.py | 106 ++-- .../aio/operations/_service_operations.py | 156 +++--- .../blob/_generated/models/__init__.py | 66 --- .../models/_azure_blob_storage_enums.py | 198 -------- .../blob/_generated/models/_models_py3.py | 15 +- .../operations/_append_blob_operations.py | 55 +- .../_generated/operations/_blob_operations.py | 418 ++++++++-------- .../operations/_block_blob_operations.py | 76 +-- .../operations/_container_operations.py | 473 ++++++++++-------- .../operations/_page_blob_operations.py | 140 +++--- .../operations/_service_operations.py | 230 ++++----- .../azure-storage-blob/swagger/README.md | 2 + 20 files changed, 1315 insertions(+), 1452 deletions(-) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py index 0a498d5118d2..6c24b7ba8661 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Union +from typing import Any from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse @@ -43,17 +43,17 @@ class AzureBlobStorage: # pylint: disable=client-accepts-api-version-keyword :param url: The URL of the service account, container, or blob that is the target of the desired operation. Required. :type url: str - :param version: Specifies the version of the operation to use for this request. "2021-12-02" - Required. - :type version: str or ~azure.storage.blob.models.Enum2 :param base_url: Service URL. Required. Default value is "". :type base_url: str + :keyword version: Specifies the version of the operation to use for this request. Default value + is "2021-12-02". Note that overriding this default value may result in unsupported behavior. + :paramtype version: str """ def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, url: str, version: Union[str, _models.Enum2], base_url: str = "", **kwargs: Any + self, url: str, base_url: str = "", **kwargs: Any ) -> None: - self._config = AzureBlobStorageConfiguration(url=url, version=version, **kwargs) + self._config = AzureBlobStorageConfiguration(url=url, **kwargs) self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py index 0a71868ef3ff..4f9875f45247 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py @@ -6,12 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Union +import sys +from typing import Any from azure.core.configuration import Configuration from azure.core.pipeline import policies -from . import models as _models +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports VERSION = "unknown" @@ -25,17 +29,17 @@ class AzureBlobStorageConfiguration(Configuration): # pylint: disable=too-many- :param url: The URL of the service account, container, or blob that is the target of the desired operation. Required. :type url: str - :param version: Specifies the version of the operation to use for this request. "2021-12-02" - Required. - :type version: str or ~azure.storage.blob.models.Enum2 + :keyword version: Specifies the version of the operation to use for this request. Default value + is "2021-12-02". Note that overriding this default value may result in unsupported behavior. + :paramtype version: str """ - def __init__(self, url: str, version: Union[str, _models.Enum2], **kwargs: Any) -> None: + def __init__(self, url: str, **kwargs: Any) -> None: super(AzureBlobStorageConfiguration, self).__init__(**kwargs) + version: Literal["2021-12-02"] = kwargs.pop("version", "2021-12-02") + if url is None: raise ValueError("Parameter 'url' must not be None.") - if version is None: - raise ValueError("Parameter 'version' must not be None.") self.url = url self.version = version diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py index 20f2dfb8268c..8b3aa72b6060 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Union +from typing import Any, Awaitable from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -43,17 +43,17 @@ class AzureBlobStorage: # pylint: disable=client-accepts-api-version-keyword :param url: The URL of the service account, container, or blob that is the target of the desired operation. Required. :type url: str - :param version: Specifies the version of the operation to use for this request. "2021-12-02" - Required. - :type version: str or ~azure.storage.blob.models.Enum2 :param base_url: Service URL. Required. Default value is "". :type base_url: str + :keyword version: Specifies the version of the operation to use for this request. Default value + is "2021-12-02". Note that overriding this default value may result in unsupported behavior. + :paramtype version: str """ def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, url: str, version: Union[str, _models.Enum2], base_url: str = "", **kwargs: Any + self, url: str, base_url: str = "", **kwargs: Any ) -> None: - self._config = AzureBlobStorageConfiguration(url=url, version=version, **kwargs) + self._config = AzureBlobStorageConfiguration(url=url, **kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py index 978601f780b9..efe9a7c79106 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py @@ -6,12 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Union +import sys +from typing import Any from azure.core.configuration import Configuration from azure.core.pipeline import policies -from .. import models as _models +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports VERSION = "unknown" @@ -25,17 +29,17 @@ class AzureBlobStorageConfiguration(Configuration): # pylint: disable=too-many- :param url: The URL of the service account, container, or blob that is the target of the desired operation. Required. :type url: str - :param version: Specifies the version of the operation to use for this request. "2021-12-02" - Required. - :type version: str or ~azure.storage.blob.models.Enum2 + :keyword version: Specifies the version of the operation to use for this request. Default value + is "2021-12-02". Note that overriding this default value may result in unsupported behavior. + :paramtype version: str """ - def __init__(self, url: str, version: Union[str, _models.Enum2], **kwargs: Any) -> None: + def __init__(self, url: str, **kwargs: Any) -> None: super(AzureBlobStorageConfiguration, self).__init__(**kwargs) + version: Literal["2021-12-02"] = kwargs.pop("version", "2021-12-02") + if url is None: raise ValueError("Parameter 'url' must not be None.") - if version is None: - raise ValueError("Parameter 'version' must not be None.") self.url = url self.version = version diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py index c78cddabd04d..d7e2b679161f 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py @@ -184,7 +184,6 @@ async def create( # pylint: disable=inconsistent-return-statements request = build_create_request( url=self._config.url, content_length=content_length, - version=self._config.version, timeout=timeout, blob_content_type=_blob_content_type, blob_content_encoding=_blob_content_encoding, @@ -209,6 +208,7 @@ async def create( # pylint: disable=inconsistent-return-statements immutability_policy_mode=immutability_policy_mode, legal_hold=legal_hold, blob_type=blob_type, + version=self._config.version, template_url=self.create.metadata["url"], headers=_headers, params=_params, @@ -256,7 +256,6 @@ async def create( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def append_block( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum37], content_length: int, body: IO, timeout: Optional[int] = None, @@ -274,8 +273,6 @@ async def append_block( # pylint: disable=inconsistent-return-statements The Append Block operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. - :param comp: comp. "appendblock" Required. - :type comp: str or ~azure.storage.blob.models.Enum37 :param content_length: The length of the request. Required. :type content_length: int :param body: Initial data. Required. @@ -306,6 +303,9 @@ async def append_block( # pylint: disable=inconsistent-return-statements :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "appendblock". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -320,8 +320,9 @@ async def append_block( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["appendblock"] = kwargs.pop("comp", _params.pop("comp", "appendblock")) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -358,9 +359,7 @@ async def append_block( # pylint: disable=inconsistent-return-statements request = build_append_block_request( url=self._config.url, - comp=comp, content_length=content_length, - version=self._config.version, timeout=timeout, transactional_content_md5=transactional_content_md5, transactional_content_crc64=transactional_content_crc64, @@ -377,7 +376,9 @@ async def append_block( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, content_type=content_type, + version=self._config.version, content=_content, template_url=self.append_block.metadata["url"], headers=_headers, @@ -434,7 +435,6 @@ async def append_block( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def append_block_from_url( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum37], source_url: str, content_length: int, source_range: Optional[str] = None, @@ -457,8 +457,6 @@ async def append_block_from_url( # pylint: disable=inconsistent-return-statemen the blob was created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. - :param comp: comp. "appendblock" Required. - :type comp: str or ~azure.storage.blob.models.Enum37 :param source_url: Specify a URL to the copy source. Required. :type source_url: str :param content_length: The length of the request. Required. @@ -500,6 +498,9 @@ async def append_block_from_url( # pylint: disable=inconsistent-return-statemen :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions + :keyword comp: comp. Default value is "appendblock". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -514,8 +515,9 @@ async def append_block_from_url( # pylint: disable=inconsistent-return-statemen error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["appendblock"] = kwargs.pop("comp", _params.pop("comp", "appendblock")) cls: ClsType[None] = kwargs.pop("cls", None) _encryption_key = None @@ -559,10 +561,8 @@ async def append_block_from_url( # pylint: disable=inconsistent-return-statemen request = build_append_block_from_url_request( url=self._config.url, - comp=comp, source_url=source_url, content_length=content_length, - version=self._config.version, source_range=source_range, source_content_md5=source_content_md5, source_contentcrc64=source_contentcrc64, @@ -586,6 +586,8 @@ async def append_block_from_url( # pylint: disable=inconsistent-return-statemen source_if_none_match=_source_if_none_match, request_id_parameter=request_id_parameter, copy_source_authorization=copy_source_authorization, + comp=comp, + version=self._config.version, template_url=self.append_block_from_url.metadata["url"], headers=_headers, params=_params, @@ -638,7 +640,6 @@ async def append_block_from_url( # pylint: disable=inconsistent-return-statemen @distributed_trace_async async def seal( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum38], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -649,8 +650,6 @@ async def seal( # pylint: disable=inconsistent-return-statements """The Seal operation seals the Append Blob to make it read-only. Seal is supported only on version 2019-12-12 version or later. - :param comp: comp. "seal" Required. - :type comp: str or ~azure.storage.blob.models.Enum38 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -667,6 +666,9 @@ async def seal( # pylint: disable=inconsistent-return-statements :param append_position_access_conditions: Parameter group. Default value is None. :type append_position_access_conditions: ~azure.storage.blob.models.AppendPositionAccessConditions + :keyword comp: comp. Default value is "seal". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -681,8 +683,9 @@ async def seal( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["seal"] = kwargs.pop("comp", _params.pop("comp", "seal")) cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None @@ -703,8 +706,6 @@ async def seal( # pylint: disable=inconsistent-return-statements request = build_seal_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, lease_id=_lease_id, @@ -713,6 +714,8 @@ async def seal( # pylint: disable=inconsistent-return-statements if_match=_if_match, if_none_match=_if_none_match, append_position=_append_position, + comp=comp, + version=self._config.version, template_url=self.seal.metadata["url"], headers=_headers, params=_params, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py index 0a83eb399651..e0392aad9b30 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py @@ -175,7 +175,6 @@ async def download( request = build_download_request( url=self._config.url, - version=self._config.version, snapshot=snapshot, version_id=version_id, timeout=timeout, @@ -192,6 +191,7 @@ async def download( if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + version=self._config.version, template_url=self.download.metadata["url"], headers=_headers, params=_params, @@ -465,7 +465,6 @@ async def get_properties( # pylint: disable=inconsistent-return-statements request = build_get_properties_request( url=self._config.url, - version=self._config.version, snapshot=snapshot, version_id=version_id, timeout=timeout, @@ -479,6 +478,7 @@ async def get_properties( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + version=self._config.version, template_url=self.get_properties.metadata["url"], headers=_headers, params=_params, @@ -682,7 +682,6 @@ async def delete( # pylint: disable=inconsistent-return-statements request = build_delete_request( url=self._config.url, - version=self._config.version, snapshot=snapshot, version_id=version_id, timeout=timeout, @@ -695,6 +694,7 @@ async def delete( # pylint: disable=inconsistent-return-statements if_tags=_if_tags, request_id_parameter=request_id_parameter, blob_delete_type=blob_delete_type, + version=self._config.version, template_url=self.delete.metadata["url"], headers=_headers, params=_params, @@ -728,16 +728,10 @@ async def delete( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def undelete( # pylint: disable=inconsistent-return-statements - self, - comp: Union[str, _models.Enum14], - timeout: Optional[int] = None, - request_id_parameter: Optional[str] = None, - **kwargs: Any + self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: """Undelete a blob that was previously soft deleted. - :param comp: comp. "undelete" Required. - :type comp: str or ~azure.storage.blob.models.Enum14 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -747,6 +741,9 @@ async def undelete( # pylint: disable=inconsistent-return-statements limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword comp: comp. Default value is "undelete". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -761,16 +758,17 @@ async def undelete( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["undelete"] = kwargs.pop("comp", _params.pop("comp", "undelete")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_undelete_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, + comp=comp, + version=self._config.version, template_url=self.undelete.metadata["url"], headers=_headers, params=_params, @@ -805,7 +803,6 @@ async def undelete( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def set_expiry( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum22], expiry_options: Union[str, _models.BlobExpiryOptions], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -814,8 +811,6 @@ async def set_expiry( # pylint: disable=inconsistent-return-statements ) -> None: """Sets the time a blob will expire and be deleted. - :param comp: comp. "expiry" Required. - :type comp: str or ~azure.storage.blob.models.Enum22 :param expiry_options: Required. Indicates mode of the expiry time. Known values are: "NeverExpire", "RelativeToCreation", "RelativeToNow", and "Absolute". Required. :type expiry_options: str or ~azure.storage.blob.models.BlobExpiryOptions @@ -830,6 +825,9 @@ async def set_expiry( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param expires_on: The time to set the blob to expiry. Default value is None. :type expires_on: str + :keyword comp: comp. Default value is "expiry". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -844,18 +842,19 @@ async def set_expiry( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["expiry"] = kwargs.pop("comp", _params.pop("comp", "expiry")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_set_expiry_request( url=self._config.url, - comp=comp, expiry_options=expiry_options, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, expires_on=expires_on, + comp=comp, + version=self._config.version, template_url=self.set_expiry.metadata["url"], headers=_headers, params=_params, @@ -892,7 +891,6 @@ async def set_expiry( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def set_http_headers( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum1], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, @@ -902,8 +900,6 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements ) -> None: """The Set HTTP Headers operation sets system properties on the blob. - :param comp: comp. "properties" Required. - :type comp: str or ~azure.storage.blob.models.Enum1 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -919,6 +915,9 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -933,8 +932,9 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) cls: ClsType[None] = kwargs.pop("cls", None) _blob_cache_control = None @@ -967,8 +967,6 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements request = build_set_http_headers_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, blob_cache_control=_blob_cache_control, blob_content_type=_blob_content_type, @@ -983,6 +981,8 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements if_tags=_if_tags, blob_content_disposition=_blob_content_disposition, request_id_parameter=request_id_parameter, + comp=comp, + version=self._config.version, template_url=self.set_http_headers.metadata["url"], headers=_headers, params=_params, @@ -1022,7 +1022,6 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def set_immutability_policy( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum24], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, @@ -1032,8 +1031,6 @@ async def set_immutability_policy( # pylint: disable=inconsistent-return-statem ) -> None: """The Set Immutability Policy operation sets the immutability policy on the blob. - :param comp: comp. "immutabilityPolicies" Required. - :type comp: str or ~azure.storage.blob.models.Enum24 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1051,6 +1048,9 @@ async def set_immutability_policy( # pylint: disable=inconsistent-return-statem :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "immutabilityPolicies". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -1065,8 +1065,9 @@ async def set_immutability_policy( # pylint: disable=inconsistent-return-statem error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["immutabilityPolicies"] = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) cls: ClsType[None] = kwargs.pop("cls", None) _if_unmodified_since = None @@ -1075,13 +1076,13 @@ async def set_immutability_policy( # pylint: disable=inconsistent-return-statem request = build_set_immutability_policy_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, if_unmodified_since=_if_unmodified_since, immutability_policy_expiry=immutability_policy_expiry, immutability_policy_mode=immutability_policy_mode, + comp=comp, + version=self._config.version, template_url=self.set_immutability_policy.metadata["url"], headers=_headers, params=_params, @@ -1121,16 +1122,10 @@ async def set_immutability_policy( # pylint: disable=inconsistent-return-statem @distributed_trace_async async def delete_immutability_policy( # pylint: disable=inconsistent-return-statements - self, - comp: Union[str, _models.Enum24], - timeout: Optional[int] = None, - request_id_parameter: Optional[str] = None, - **kwargs: Any + self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: """The Delete Immutability Policy operation deletes the immutability policy on the blob. - :param comp: comp. "immutabilityPolicies" Required. - :type comp: str or ~azure.storage.blob.models.Enum24 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1140,6 +1135,9 @@ async def delete_immutability_policy( # pylint: disable=inconsistent-return-sta limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword comp: comp. Default value is "immutabilityPolicies". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -1154,16 +1152,17 @@ async def delete_immutability_policy( # pylint: disable=inconsistent-return-sta error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["immutabilityPolicies"] = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_immutability_policy_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, + comp=comp, + version=self._config.version, template_url=self.delete_immutability_policy.metadata["url"], headers=_headers, params=_params, @@ -1197,17 +1196,10 @@ async def delete_immutability_policy( # pylint: disable=inconsistent-return-sta @distributed_trace_async async def set_legal_hold( # pylint: disable=inconsistent-return-statements - self, - comp: Union[str, _models.Enum25], - legal_hold: bool, - timeout: Optional[int] = None, - request_id_parameter: Optional[str] = None, - **kwargs: Any + self, legal_hold: bool, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: """The Set Legal Hold operation sets a legal hold on the blob. - :param comp: comp. "legalhold" Required. - :type comp: str or ~azure.storage.blob.models.Enum25 :param legal_hold: Specified if a legal hold should be set on the blob. Required. :type legal_hold: bool :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -1219,6 +1211,9 @@ async def set_legal_hold( # pylint: disable=inconsistent-return-statements limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword comp: comp. Default value is "legalhold". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -1233,17 +1228,18 @@ async def set_legal_hold( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["legalhold"] = kwargs.pop("comp", _params.pop("comp", "legalhold")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_set_legal_hold_request( url=self._config.url, - comp=comp, legal_hold=legal_hold, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, + comp=comp, + version=self._config.version, template_url=self.set_legal_hold.metadata["url"], headers=_headers, params=_params, @@ -1279,7 +1275,6 @@ async def set_legal_hold( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def set_metadata( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum12], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, request_id_parameter: Optional[str] = None, @@ -1292,8 +1287,6 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements """The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-value pairs. - :param comp: comp. "metadata" Required. - :type comp: str or ~azure.storage.blob.models.Enum12 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1319,6 +1312,9 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "metadata". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -1333,8 +1329,9 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None @@ -1364,8 +1361,6 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements request = build_set_metadata_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, metadata=metadata, lease_id=_lease_id, @@ -1379,6 +1374,8 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, + version=self._config.version, template_url=self.set_metadata.metadata["url"], headers=_headers, params=_params, @@ -1425,7 +1422,6 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def acquire_lease( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum16], timeout: Optional[int] = None, duration: Optional[int] = None, proposed_lease_id: Optional[str] = None, @@ -1436,8 +1432,6 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements """[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - :param comp: comp. "lease" Required. - :type comp: str or ~azure.storage.blob.models.Enum16 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1457,6 +1451,9 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword action: Describes what lease action to take. Default value is "acquire". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1474,8 +1471,9 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1493,8 +1491,6 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements request = build_acquire_lease_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, duration=duration, proposed_lease_id=proposed_lease_id, @@ -1504,7 +1500,9 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, action=action, + version=self._config.version, template_url=self.acquire_lease.metadata["url"], headers=_headers, params=_params, @@ -1542,7 +1540,6 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def release_lease( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum16], lease_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -1552,8 +1549,6 @@ async def release_lease( # pylint: disable=inconsistent-return-statements """[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - :param comp: comp. "lease" Required. - :type comp: str or ~azure.storage.blob.models.Enum16 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -1567,6 +1562,9 @@ async def release_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword action: Describes what lease action to take. Default value is "release". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1584,8 +1582,9 @@ async def release_lease( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1603,9 +1602,7 @@ async def release_lease( # pylint: disable=inconsistent-return-statements request = build_release_lease_request( url=self._config.url, - comp=comp, lease_id=lease_id, - version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, @@ -1613,7 +1610,9 @@ async def release_lease( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, action=action, + version=self._config.version, template_url=self.release_lease.metadata["url"], headers=_headers, params=_params, @@ -1650,7 +1649,6 @@ async def release_lease( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def renew_lease( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum16], lease_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -1660,8 +1658,6 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements """[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - :param comp: comp. "lease" Required. - :type comp: str or ~azure.storage.blob.models.Enum16 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -1675,6 +1671,9 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword action: Describes what lease action to take. Default value is "renew". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1692,8 +1691,9 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1711,9 +1711,7 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements request = build_renew_lease_request( url=self._config.url, - comp=comp, lease_id=lease_id, - version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, @@ -1721,7 +1719,9 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, action=action, + version=self._config.version, template_url=self.renew_lease.metadata["url"], headers=_headers, params=_params, @@ -1759,7 +1759,6 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def change_lease( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum16], lease_id: str, proposed_lease_id: str, timeout: Optional[int] = None, @@ -1770,8 +1769,6 @@ async def change_lease( # pylint: disable=inconsistent-return-statements """[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - :param comp: comp. "lease" Required. - :type comp: str or ~azure.storage.blob.models.Enum16 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param proposed_lease_id: Proposed lease ID, in a GUID string format. The Blob service returns @@ -1789,6 +1786,9 @@ async def change_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword action: Describes what lease action to take. Default value is "change". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1806,8 +1806,9 @@ async def change_lease( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1825,10 +1826,8 @@ async def change_lease( # pylint: disable=inconsistent-return-statements request = build_change_lease_request( url=self._config.url, - comp=comp, lease_id=lease_id, proposed_lease_id=proposed_lease_id, - version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, @@ -1836,7 +1835,9 @@ async def change_lease( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, action=action, + version=self._config.version, template_url=self.change_lease.metadata["url"], headers=_headers, params=_params, @@ -1874,7 +1875,6 @@ async def change_lease( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def break_lease( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum16], timeout: Optional[int] = None, break_period: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -1884,8 +1884,6 @@ async def break_lease( # pylint: disable=inconsistent-return-statements """[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - :param comp: comp. "lease" Required. - :type comp: str or ~azure.storage.blob.models.Enum16 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1905,6 +1903,9 @@ async def break_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword action: Describes what lease action to take. Default value is "break". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1922,8 +1923,9 @@ async def break_lease( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1941,8 +1943,6 @@ async def break_lease( # pylint: disable=inconsistent-return-statements request = build_break_lease_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, break_period=break_period, if_modified_since=_if_modified_since, @@ -1951,7 +1951,9 @@ async def break_lease( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, action=action, + version=self._config.version, template_url=self.break_lease.metadata["url"], headers=_headers, params=_params, @@ -1989,7 +1991,6 @@ async def break_lease( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def create_snapshot( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum26], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, request_id_parameter: Optional[str] = None, @@ -2001,8 +2002,6 @@ async def create_snapshot( # pylint: disable=inconsistent-return-statements ) -> None: """The Create Snapshot operation creates a read-only snapshot of a blob. - :param comp: comp. "snapshot" Required. - :type comp: str or ~azure.storage.blob.models.Enum26 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -2028,6 +2027,9 @@ async def create_snapshot( # pylint: disable=inconsistent-return-statements :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword comp: comp. Default value is "snapshot". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -2042,8 +2044,9 @@ async def create_snapshot( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["snapshot"] = kwargs.pop("comp", _params.pop("comp", "snapshot")) cls: ClsType[None] = kwargs.pop("cls", None) _encryption_key = None @@ -2073,8 +2076,6 @@ async def create_snapshot( # pylint: disable=inconsistent-return-statements request = build_create_snapshot_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, metadata=metadata, encryption_key=_encryption_key, @@ -2088,6 +2089,8 @@ async def create_snapshot( # pylint: disable=inconsistent-return-statements if_tags=_if_tags, lease_id=_lease_id, request_id_parameter=request_id_parameter, + comp=comp, + version=self._config.version, template_url=self.create_snapshot.metadata["url"], headers=_headers, params=_params, @@ -2244,7 +2247,6 @@ async def start_copy_from_url( # pylint: disable=inconsistent-return-statements request = build_start_copy_from_url_request( url=self._config.url, copy_source=copy_source, - version=self._config.version, timeout=timeout, metadata=metadata, tier=tier, @@ -2266,6 +2268,7 @@ async def start_copy_from_url( # pylint: disable=inconsistent-return-statements immutability_policy_expiry=immutability_policy_expiry, immutability_policy_mode=immutability_policy_mode, legal_hold=legal_hold, + version=self._config.version, template_url=self.start_copy_from_url.metadata["url"], headers=_headers, params=_params, @@ -2305,7 +2308,6 @@ async def start_copy_from_url( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def copy_from_url( # pylint: disable=inconsistent-return-statements self, - x_ms_requires_sync: Union[str, _models.Enum27], copy_source: str, timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, @@ -2327,9 +2329,6 @@ async def copy_from_url( # pylint: disable=inconsistent-return-statements """The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response until the copy is complete. - :param x_ms_requires_sync: This header indicates that this is a synchronous Copy Blob From URL - instead of a Asynchronous Copy Blob. "true" Required. - :type x_ms_requires_sync: str or ~azure.storage.blob.models.Enum27 :param copy_source: Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated @@ -2386,6 +2385,10 @@ async def copy_from_url( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo + :keyword x_ms_requires_sync: This header indicates that this is a synchronous Copy Blob From + URL instead of a Asynchronous Copy Blob. Default value is "true". Note that overriding this + default value may result in unsupported behavior. + :paramtype x_ms_requires_sync: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -2399,9 +2402,12 @@ async def copy_from_url( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + x_ms_requires_sync: Literal["true"] = kwargs.pop( + "x_ms_requires_sync", _headers.pop("x-ms-requires-sync", "true") + ) cls: ClsType[None] = kwargs.pop("cls", None) _source_if_modified_since = None @@ -2433,9 +2439,7 @@ async def copy_from_url( # pylint: disable=inconsistent-return-statements request = build_copy_from_url_request( url=self._config.url, - x_ms_requires_sync=x_ms_requires_sync, copy_source=copy_source, - version=self._config.version, timeout=timeout, metadata=metadata, tier=tier, @@ -2458,6 +2462,8 @@ async def copy_from_url( # pylint: disable=inconsistent-return-statements copy_source_authorization=copy_source_authorization, encryption_scope=_encryption_scope, copy_source_tags=copy_source_tags, + x_ms_requires_sync=x_ms_requires_sync, + version=self._config.version, template_url=self.copy_from_url.metadata["url"], headers=_headers, params=_params, @@ -2504,8 +2510,6 @@ async def copy_from_url( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def abort_copy_from_url( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum28], - copy_action_abort_constant: Union[str, _models.Enum29], copy_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -2515,10 +2519,6 @@ async def abort_copy_from_url( # pylint: disable=inconsistent-return-statements """The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with zero length and full metadata. - :param comp: comp. "copy" Required. - :type comp: str or ~azure.storage.blob.models.Enum28 - :param copy_action_abort_constant: Copy action. "abort" Required. - :type copy_action_abort_constant: str or ~azure.storage.blob.models.Enum29 :param copy_id: The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. Required. :type copy_id: str @@ -2533,6 +2533,12 @@ async def abort_copy_from_url( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword comp: comp. Default value is "copy". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword copy_action_abort_constant: Copy action. Default value is "abort". Note that + overriding this default value may result in unsupported behavior. + :paramtype copy_action_abort_constant: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -2546,9 +2552,13 @@ async def abort_copy_from_url( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["copy"] = kwargs.pop("comp", _params.pop("comp", "copy")) + copy_action_abort_constant: Literal["abort"] = kwargs.pop( + "copy_action_abort_constant", _headers.pop("x-ms-copy-action", "abort") + ) cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None @@ -2557,13 +2567,13 @@ async def abort_copy_from_url( # pylint: disable=inconsistent-return-statements request = build_abort_copy_from_url_request( url=self._config.url, - comp=comp, - copy_action_abort_constant=copy_action_abort_constant, copy_id=copy_id, - version=self._config.version, timeout=timeout, lease_id=_lease_id, request_id_parameter=request_id_parameter, + comp=comp, + copy_action_abort_constant=copy_action_abort_constant, + version=self._config.version, template_url=self.abort_copy_from_url.metadata["url"], headers=_headers, params=_params, @@ -2598,7 +2608,6 @@ async def abort_copy_from_url( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def set_tier( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum30], tier: Union[str, _models.AccessTierRequired], snapshot: Optional[str] = None, version_id: Optional[str] = None, @@ -2615,8 +2624,6 @@ async def set_tier( # pylint: disable=inconsistent-return-statements the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag. - :param comp: comp. "tier" Required. - :type comp: str or ~azure.storage.blob.models.Enum30 :param tier: Indicates the tier to be set on the blob. Known values are: "P4", "P6", "P10", "P15", "P20", "P30", "P40", "P50", "P60", "P70", "P80", "Hot", "Cool", "Archive", and "Cold". Required. @@ -2647,6 +2654,9 @@ async def set_tier( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "tier". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -2661,8 +2671,9 @@ async def set_tier( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["tier"] = kwargs.pop("comp", _params.pop("comp", "tier")) cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None @@ -2674,9 +2685,7 @@ async def set_tier( # pylint: disable=inconsistent-return-statements request = build_set_tier_request( url=self._config.url, - comp=comp, tier=tier, - version=self._config.version, snapshot=snapshot, version_id=version_id, timeout=timeout, @@ -2684,6 +2693,8 @@ async def set_tier( # pylint: disable=inconsistent-return-statements request_id_parameter=request_id_parameter, lease_id=_lease_id, if_tags=_if_tags, + comp=comp, + version=self._config.version, template_url=self.set_tier.metadata["url"], headers=_headers, params=_params, @@ -2723,15 +2734,15 @@ async def set_tier( # pylint: disable=inconsistent-return-statements set_tier.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace_async - async def get_account_info( # pylint: disable=inconsistent-return-statements - self, restype: Union[str, _models.Enum8], comp: Union[str, _models.Enum1], **kwargs: Any - ) -> None: + async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements """Returns the sku name and account kind. - :param restype: restype. "account" Required. - :type restype: str or ~azure.storage.blob.models.Enum8 - :param comp: comp. "properties" Required. - :type comp: str or ~azure.storage.blob.models.Enum1 + :keyword restype: restype. Default value is "account". Note that overriding this default value + may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -2746,8 +2757,10 @@ async def get_account_info( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account")) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_get_account_info_request( @@ -2791,7 +2804,6 @@ async def get_account_info( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def query( self, - comp: Union[str, _models.Enum39], snapshot: Optional[str] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -2804,8 +2816,6 @@ async def query( """The Query operation enables users to select/project on blob data by providing simple query expressions. - :param comp: comp. "query" Required. - :type comp: str or ~azure.storage.blob.models.Enum39 :param snapshot: The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:` _models.BlobTags: """The Get Tags operation enables users to get the tags associated with a blob. - :param comp: comp. "tags" Required. - :type comp: str or ~azure.storage.blob.models.Enum41 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -3080,6 +3091,9 @@ async def get_tags( :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword comp: comp. Default value is "tags". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: BlobTags or the result of cls(response) :rtype: ~azure.storage.blob.models.BlobTags @@ -3094,8 +3108,9 @@ async def get_tags( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["tags"] = kwargs.pop("comp", _params.pop("comp", "tags")) cls: ClsType[_models.BlobTags] = kwargs.pop("cls", None) _if_tags = None @@ -3107,14 +3122,14 @@ async def get_tags( request = build_get_tags_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, snapshot=snapshot, version_id=version_id, if_tags=_if_tags, lease_id=_lease_id, + comp=comp, + version=self._config.version, template_url=self.get_tags.metadata["url"], headers=_headers, params=_params, @@ -3153,7 +3168,6 @@ async def get_tags( @distributed_trace_async async def set_tags( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum41], timeout: Optional[int] = None, version_id: Optional[str] = None, transactional_content_md5: Optional[bytes] = None, @@ -3166,8 +3180,6 @@ async def set_tags( # pylint: disable=inconsistent-return-statements ) -> None: """The Set Tags operation enables users to set tags on a blob. - :param comp: comp. "tags" Required. - :type comp: str or ~azure.storage.blob.models.Enum41 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -3193,6 +3205,9 @@ async def set_tags( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param tags: Blob tags. Default value is None. :type tags: ~azure.storage.blob.models.BlobTags + :keyword comp: comp. Default value is "tags". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -3207,8 +3222,9 @@ async def set_tags( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["tags"] = kwargs.pop("comp", _params.pop("comp", "tags")) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -3225,8 +3241,6 @@ async def set_tags( # pylint: disable=inconsistent-return-statements request = build_set_tags_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, version_id=version_id, transactional_content_md5=transactional_content_md5, @@ -3234,7 +3248,9 @@ async def set_tags( # pylint: disable=inconsistent-return-statements request_id_parameter=request_id_parameter, if_tags=_if_tags, lease_id=_lease_id, + comp=comp, content_type=content_type, + version=self._config.version, content=_content, template_url=self.set_tags.metadata["url"], headers=_headers, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py index aef273987071..ef347a461baf 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py @@ -208,7 +208,6 @@ async def upload( # pylint: disable=inconsistent-return-statements request = build_upload_request( url=self._config.url, content_length=content_length, - version=self._config.version, timeout=timeout, transactional_content_md5=transactional_content_md5, blob_content_type=_blob_content_type, @@ -237,6 +236,7 @@ async def upload( # pylint: disable=inconsistent-return-statements transactional_content_crc64=transactional_content_crc64, blob_type=blob_type, content_type=content_type, + version=self._config.version, content=_content, template_url=self.upload.metadata["url"], headers=_headers, @@ -447,7 +447,6 @@ async def put_blob_from_url( # pylint: disable=inconsistent-return-statements url=self._config.url, content_length=content_length, copy_source=copy_source, - version=self._config.version, timeout=timeout, transactional_content_md5=transactional_content_md5, blob_content_type=_blob_content_type, @@ -480,6 +479,7 @@ async def put_blob_from_url( # pylint: disable=inconsistent-return-statements copy_source_authorization=copy_source_authorization, copy_source_tags=copy_source_tags, blob_type=blob_type, + version=self._config.version, template_url=self.put_blob_from_url.metadata["url"], headers=_headers, params=_params, @@ -527,7 +527,6 @@ async def put_blob_from_url( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def stage_block( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum32], block_id: str, content_length: int, body: IO, @@ -542,8 +541,6 @@ async def stage_block( # pylint: disable=inconsistent-return-statements ) -> None: """The Stage Block operation creates a new block to be committed as part of a blob. - :param comp: comp. "block" Required. - :type comp: str or ~azure.storage.blob.models.Enum32 :param block_id: A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the same size for each block. Required. @@ -573,6 +570,9 @@ async def stage_block( # pylint: disable=inconsistent-return-statements :type cpk_info: ~azure.storage.blob.models.CpkInfo :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo + :keyword comp: comp. Default value is "block". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -587,8 +587,9 @@ async def stage_block( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["block"] = kwargs.pop("comp", _params.pop("comp", "block")) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -609,10 +610,8 @@ async def stage_block( # pylint: disable=inconsistent-return-statements request = build_stage_block_request( url=self._config.url, - comp=comp, block_id=block_id, content_length=content_length, - version=self._config.version, transactional_content_md5=transactional_content_md5, transactional_content_crc64=transactional_content_crc64, timeout=timeout, @@ -622,7 +621,9 @@ async def stage_block( # pylint: disable=inconsistent-return-statements encryption_algorithm=_encryption_algorithm, encryption_scope=_encryption_scope, request_id_parameter=request_id_parameter, + comp=comp, content_type=content_type, + version=self._config.version, content=_content, template_url=self.stage_block.metadata["url"], headers=_headers, @@ -671,7 +672,6 @@ async def stage_block( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def stage_block_from_url( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum32], block_id: str, content_length: int, source_url: str, @@ -690,8 +690,6 @@ async def stage_block_from_url( # pylint: disable=inconsistent-return-statement """The Stage Block operation creates a new block to be committed as part of a blob where the contents are read from a URL. - :param comp: comp. "block" Required. - :type comp: str or ~azure.storage.blob.models.Enum32 :param block_id: A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the same size for each block. Required. @@ -729,6 +727,9 @@ async def stage_block_from_url( # pylint: disable=inconsistent-return-statement :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions + :keyword comp: comp. Default value is "block". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -743,8 +744,9 @@ async def stage_block_from_url( # pylint: disable=inconsistent-return-statement error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["block"] = kwargs.pop("comp", _params.pop("comp", "block")) cls: ClsType[None] = kwargs.pop("cls", None) _encryption_key = None @@ -772,11 +774,9 @@ async def stage_block_from_url( # pylint: disable=inconsistent-return-statement request = build_stage_block_from_url_request( url=self._config.url, - comp=comp, block_id=block_id, content_length=content_length, source_url=source_url, - version=self._config.version, source_range=source_range, source_content_md5=source_content_md5, source_contentcrc64=source_contentcrc64, @@ -792,6 +792,8 @@ async def stage_block_from_url( # pylint: disable=inconsistent-return-statement source_if_none_match=_source_if_none_match, request_id_parameter=request_id_parameter, copy_source_authorization=copy_source_authorization, + comp=comp, + version=self._config.version, template_url=self.stage_block_from_url.metadata["url"], headers=_headers, params=_params, @@ -839,7 +841,6 @@ async def stage_block_from_url( # pylint: disable=inconsistent-return-statement @distributed_trace_async async def commit_block_list( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum33], blocks: _models.BlockLookupList, timeout: Optional[int] = None, transactional_content_md5: Optional[bytes] = None, @@ -866,8 +867,6 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements or from the uncommitted block list, or to commit the most recently uploaded version of the block, whichever list it may belong to. - :param comp: comp. "blocklist" Required. - :type comp: str or ~azure.storage.blob.models.Enum33 :param blocks: Blob Blocks. Required. :type blocks: ~azure.storage.blob.models.BlockLookupList :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -918,6 +917,9 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "blocklist". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -932,8 +934,9 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["blocklist"] = kwargs.pop("comp", _params.pop("comp", "blocklist")) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -978,8 +981,6 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements request = build_commit_block_list_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, blob_cache_control=_blob_cache_control, blob_content_type=_blob_content_type, @@ -1006,7 +1007,9 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements immutability_policy_expiry=immutability_policy_expiry, immutability_policy_mode=immutability_policy_mode, legal_hold=legal_hold, + comp=comp, content_type=content_type, + version=self._config.version, content=_content, template_url=self.commit_block_list.metadata["url"], headers=_headers, @@ -1058,7 +1061,6 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def get_block_list( self, - comp: Union[str, _models.Enum33], snapshot: Optional[str] = None, list_type: Union[str, _models.BlockListType] = "committed", timeout: Optional[int] = None, @@ -1070,8 +1072,6 @@ async def get_block_list( """The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob. - :param comp: comp. "blocklist" Required. - :type comp: str or ~azure.storage.blob.models.Enum33 :param snapshot: The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:` None: @distributed_trace_async async def create( # pylint: disable=inconsistent-return-statements self, - restype: Union[str, _models.Enum11], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, access: Optional[Union[str, _models.PublicAccessType]] = None, @@ -87,8 +86,6 @@ async def create( # pylint: disable=inconsistent-return-statements """creates a new container under the specified account. If the container with the same name already exists, the operation fails. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -111,6 +108,9 @@ async def create( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param container_cpk_scope_info: Parameter group. Default value is None. :type container_cpk_scope_info: ~azure.storage.blob.models.ContainerCpkScopeInfo + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -125,8 +125,9 @@ async def create( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) cls: ClsType[None] = kwargs.pop("cls", None) _default_encryption_scope = None @@ -137,14 +138,14 @@ async def create( # pylint: disable=inconsistent-return-statements request = build_create_request( url=self._config.url, - restype=restype, - version=self._config.version, timeout=timeout, metadata=metadata, access=access, request_id_parameter=request_id_parameter, default_encryption_scope=_default_encryption_scope, prevent_encryption_scope_override=_prevent_encryption_scope_override, + restype=restype, + version=self._config.version, template_url=self.create.metadata["url"], headers=_headers, params=_params, @@ -181,7 +182,6 @@ async def create( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def get_properties( # pylint: disable=inconsistent-return-statements self, - restype: Union[str, _models.Enum11], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -190,8 +190,6 @@ async def get_properties( # pylint: disable=inconsistent-return-statements """returns all user-defined metadata and system properties for the specified container. The data returned does not include the container's list of blobs. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -203,6 +201,9 @@ async def get_properties( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -217,8 +218,9 @@ async def get_properties( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None @@ -227,11 +229,11 @@ async def get_properties( # pylint: disable=inconsistent-return-statements request = build_get_properties_request( url=self._config.url, - restype=restype, - version=self._config.version, timeout=timeout, lease_id=_lease_id, request_id_parameter=request_id_parameter, + restype=restype, + version=self._config.version, template_url=self.get_properties.metadata["url"], headers=_headers, params=_params, @@ -288,7 +290,6 @@ async def get_properties( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, - restype: Union[str, _models.Enum11], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -298,8 +299,6 @@ async def delete( # pylint: disable=inconsistent-return-statements """operation marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -313,6 +312,9 @@ async def delete( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -327,8 +329,9 @@ async def delete( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None @@ -342,13 +345,13 @@ async def delete( # pylint: disable=inconsistent-return-statements request = build_delete_request( url=self._config.url, - restype=restype, - version=self._config.version, timeout=timeout, lease_id=_lease_id, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, + restype=restype, + version=self._config.version, template_url=self.delete.metadata["url"], headers=_headers, params=_params, @@ -383,8 +386,6 @@ async def delete( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def set_metadata( # pylint: disable=inconsistent-return-statements self, - restype: Union[str, _models.Enum11], - comp: Union[str, _models.Enum12], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, request_id_parameter: Optional[str] = None, @@ -394,10 +395,6 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements ) -> None: """operation sets one or more user-defined name-value pairs for the specified container. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 - :param comp: comp. "metadata" Required. - :type comp: str or ~azure.storage.blob.models.Enum12 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -419,6 +416,12 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "metadata". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -433,8 +436,10 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) + comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None @@ -446,14 +451,14 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements request = build_set_metadata_request( url=self._config.url, - restype=restype, - comp=comp, - version=self._config.version, timeout=timeout, lease_id=_lease_id, metadata=metadata, if_modified_since=_if_modified_since, request_id_parameter=request_id_parameter, + restype=restype, + comp=comp, + version=self._config.version, template_url=self.set_metadata.metadata["url"], headers=_headers, params=_params, @@ -490,8 +495,6 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def get_access_policy( self, - restype: Union[str, _models.Enum11], - comp: Union[str, _models.Enum13], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -500,10 +503,6 @@ async def get_access_policy( """gets the permissions for the specified container. The permissions indicate whether container data may be accessed publicly. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 - :param comp: comp. "acl" Required. - :type comp: str or ~azure.storage.blob.models.Enum13 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -515,6 +514,12 @@ async def get_access_policy( :type request_id_parameter: str :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "acl". Note that overriding this default value may result + in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of SignedIdentifier or the result of cls(response) :rtype: list[~azure.storage.blob.models.SignedIdentifier] @@ -529,8 +534,10 @@ async def get_access_policy( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) + comp: Literal["acl"] = kwargs.pop("comp", _params.pop("comp", "acl")) cls: ClsType[List[_models.SignedIdentifier]] = kwargs.pop("cls", None) _lease_id = None @@ -539,12 +546,12 @@ async def get_access_policy( request = build_get_access_policy_request( url=self._config.url, - restype=restype, - comp=comp, - version=self._config.version, timeout=timeout, lease_id=_lease_id, request_id_parameter=request_id_parameter, + restype=restype, + comp=comp, + version=self._config.version, template_url=self.get_access_policy.metadata["url"], headers=_headers, params=_params, @@ -588,8 +595,6 @@ async def get_access_policy( @distributed_trace_async async def set_access_policy( # pylint: disable=inconsistent-return-statements self, - restype: Union[str, _models.Enum11], - comp: Union[str, _models.Enum13], timeout: Optional[int] = None, access: Optional[Union[str, _models.PublicAccessType]] = None, request_id_parameter: Optional[str] = None, @@ -601,10 +606,6 @@ async def set_access_policy( # pylint: disable=inconsistent-return-statements """sets the permissions for the specified container. The permissions indicate whether blobs in a container may be accessed publicly. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 - :param comp: comp. "acl" Required. - :type comp: str or ~azure.storage.blob.models.Enum13 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -623,6 +624,12 @@ async def set_access_policy( # pylint: disable=inconsistent-return-statements :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param container_acl: the acls for the container. Default value is None. :type container_acl: list[~azure.storage.blob.models.SignedIdentifier] + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "acl". Note that overriding this default value may result + in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -637,8 +644,10 @@ async def set_access_policy( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) + comp: Literal["acl"] = kwargs.pop("comp", _params.pop("comp", "acl")) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -660,16 +669,16 @@ async def set_access_policy( # pylint: disable=inconsistent-return-statements request = build_set_access_policy_request( url=self._config.url, - restype=restype, - comp=comp, - version=self._config.version, timeout=timeout, lease_id=_lease_id, access=access, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, + restype=restype, + comp=comp, content_type=content_type, + version=self._config.version, content=_content, template_url=self.set_access_policy.metadata["url"], headers=_headers, @@ -707,8 +716,6 @@ async def set_access_policy( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def restore( # pylint: disable=inconsistent-return-statements self, - restype: Union[str, _models.Enum11], - comp: Union[str, _models.Enum14], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, deleted_container_name: Optional[str] = None, @@ -717,10 +724,6 @@ async def restore( # pylint: disable=inconsistent-return-statements ) -> None: """Restores a previously-deleted container. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 - :param comp: comp. "undelete" Required. - :type comp: str or ~azure.storage.blob.models.Enum14 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -736,6 +739,12 @@ async def restore( # pylint: disable=inconsistent-return-statements :param deleted_container_version: Optional. Version 2019-12-12 and later. Specifies the version of the deleted container to restore. Default value is None. :type deleted_container_version: str + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "undelete". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -750,19 +759,21 @@ async def restore( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) + comp: Literal["undelete"] = kwargs.pop("comp", _params.pop("comp", "undelete")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_restore_request( url=self._config.url, - restype=restype, - comp=comp, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, deleted_container_name=deleted_container_name, deleted_container_version=deleted_container_version, + restype=restype, + comp=comp, + version=self._config.version, template_url=self.restore.metadata["url"], headers=_headers, params=_params, @@ -797,8 +808,6 @@ async def restore( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def rename( # pylint: disable=inconsistent-return-statements self, - restype: Union[str, _models.Enum11], - comp: Union[str, _models.Enum15], source_container_name: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -807,10 +816,6 @@ async def rename( # pylint: disable=inconsistent-return-statements ) -> None: """Renames an existing container. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 - :param comp: comp. "rename" Required. - :type comp: str or ~azure.storage.blob.models.Enum15 :param source_container_name: Required. Specifies the name of the container to rename. Required. :type source_container_name: str @@ -826,6 +831,12 @@ async def rename( # pylint: disable=inconsistent-return-statements :param source_lease_id: A lease ID for the source path. If specified, the source path must have an active lease and the lease ID must match. Default value is None. :type source_lease_id: str + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "rename". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -840,19 +851,21 @@ async def rename( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) + comp: Literal["rename"] = kwargs.pop("comp", _params.pop("comp", "rename")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_rename_request( url=self._config.url, - restype=restype, - comp=comp, source_container_name=source_container_name, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, source_lease_id=source_lease_id, + restype=restype, + comp=comp, + version=self._config.version, template_url=self.rename.metadata["url"], headers=_headers, params=_params, @@ -887,8 +900,6 @@ async def rename( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def submit_batch( self, - restype: Union[str, _models.Enum11], - comp: Union[str, _models.Enum9], content_length: int, body: IO, timeout: Optional[int] = None, @@ -897,10 +908,6 @@ async def submit_batch( ) -> AsyncIterator[bytes]: """The Batch operation allows multiple API calls to be embedded into a single HTTP request. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 - :param comp: comp. "batch" Required. - :type comp: str or ~azure.storage.blob.models.Enum9 :param content_length: The length of the request. Required. :type content_length: int :param body: Initial data. Required. @@ -914,6 +921,12 @@ async def submit_batch( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "batch". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Async iterator of the response bytes or the result of cls(response) :rtype: AsyncIterator[bytes] @@ -928,8 +941,10 @@ async def submit_batch( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) + comp: Literal["batch"] = kwargs.pop("comp", _params.pop("comp", "batch")) multipart_content_type: str = kwargs.pop( "multipart_content_type", _headers.pop("Content-Type", "application/xml") ) @@ -939,13 +954,13 @@ async def submit_batch( request = build_submit_batch_request( url=self._config.url, - restype=restype, - comp=comp, content_length=content_length, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, + restype=restype, + comp=comp, multipart_content_type=multipart_content_type, + version=self._config.version, content=_content, template_url=self.submit_batch.metadata["url"], headers=_headers, @@ -982,8 +997,6 @@ async def submit_batch( @distributed_trace_async async def filter_blobs( self, - restype: Union[str, _models.Enum11], - comp: Union[str, _models.Enum10], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, where: Optional[str] = None, @@ -995,10 +1008,6 @@ async def filter_blobs( """The Filter Blobs operation enables callers to list blobs in a container whose tags match a given search expression. Filter blobs searches within the given container. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 - :param comp: comp. "blobs" Required. - :type comp: str or ~azure.storage.blob.models.Enum10 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1028,6 +1037,12 @@ async def filter_blobs( :param include: Include this parameter to specify one or more datasets to include in the response. Default value is None. :type include: list[str or ~azure.storage.blob.models.FilterBlobsIncludeItem] + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "blobs". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FilterBlobSegment or the result of cls(response) :rtype: ~azure.storage.blob.models.FilterBlobSegment @@ -1042,21 +1057,23 @@ async def filter_blobs( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) + comp: Literal["blobs"] = kwargs.pop("comp", _params.pop("comp", "blobs")) cls: ClsType[_models.FilterBlobSegment] = kwargs.pop("cls", None) request = build_filter_blobs_request( url=self._config.url, - restype=restype, - comp=comp, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, where=where, marker=marker, maxresults=maxresults, include=include, + restype=restype, + comp=comp, + version=self._config.version, template_url=self.filter_blobs.metadata["url"], headers=_headers, params=_params, @@ -1095,8 +1112,6 @@ async def filter_blobs( @distributed_trace_async async def acquire_lease( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum16], - restype: Union[str, _models.Enum11], timeout: Optional[int] = None, duration: Optional[int] = None, proposed_lease_id: Optional[str] = None, @@ -1107,10 +1122,6 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements """[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. - :param comp: comp. "lease" Required. - :type comp: str or ~azure.storage.blob.models.Enum16 - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1130,6 +1141,12 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword action: Describes what lease action to take. Default value is "acquire". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1147,8 +1164,10 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1160,16 +1179,16 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements request = build_acquire_lease_request( url=self._config.url, - comp=comp, - restype=restype, - version=self._config.version, timeout=timeout, duration=duration, proposed_lease_id=proposed_lease_id, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, + comp=comp, + restype=restype, action=action, + version=self._config.version, template_url=self.acquire_lease.metadata["url"], headers=_headers, params=_params, @@ -1207,8 +1226,6 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def release_lease( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum16], - restype: Union[str, _models.Enum11], lease_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -1218,10 +1235,6 @@ async def release_lease( # pylint: disable=inconsistent-return-statements """[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. - :param comp: comp. "lease" Required. - :type comp: str or ~azure.storage.blob.models.Enum16 - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -1235,6 +1248,12 @@ async def release_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword action: Describes what lease action to take. Default value is "release". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1252,8 +1271,10 @@ async def release_lease( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1265,15 +1286,15 @@ async def release_lease( # pylint: disable=inconsistent-return-statements request = build_release_lease_request( url=self._config.url, - comp=comp, - restype=restype, lease_id=lease_id, - version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, + comp=comp, + restype=restype, action=action, + version=self._config.version, template_url=self.release_lease.metadata["url"], headers=_headers, params=_params, @@ -1310,8 +1331,6 @@ async def release_lease( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def renew_lease( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum16], - restype: Union[str, _models.Enum11], lease_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -1321,10 +1340,6 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements """[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. - :param comp: comp. "lease" Required. - :type comp: str or ~azure.storage.blob.models.Enum16 - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -1338,6 +1353,12 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword action: Describes what lease action to take. Default value is "renew". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1355,8 +1376,10 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1368,15 +1391,15 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements request = build_renew_lease_request( url=self._config.url, - comp=comp, - restype=restype, lease_id=lease_id, - version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, + comp=comp, + restype=restype, action=action, + version=self._config.version, template_url=self.renew_lease.metadata["url"], headers=_headers, params=_params, @@ -1414,8 +1437,6 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def break_lease( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum16], - restype: Union[str, _models.Enum11], timeout: Optional[int] = None, break_period: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -1425,10 +1446,6 @@ async def break_lease( # pylint: disable=inconsistent-return-statements """[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. - :param comp: comp. "lease" Required. - :type comp: str or ~azure.storage.blob.models.Enum16 - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1448,6 +1465,12 @@ async def break_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword action: Describes what lease action to take. Default value is "break". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1465,8 +1488,10 @@ async def break_lease( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1478,15 +1503,15 @@ async def break_lease( # pylint: disable=inconsistent-return-statements request = build_break_lease_request( url=self._config.url, - comp=comp, - restype=restype, - version=self._config.version, timeout=timeout, break_period=break_period, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, + comp=comp, + restype=restype, action=action, + version=self._config.version, template_url=self.break_lease.metadata["url"], headers=_headers, params=_params, @@ -1524,8 +1549,6 @@ async def break_lease( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def change_lease( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum16], - restype: Union[str, _models.Enum11], lease_id: str, proposed_lease_id: str, timeout: Optional[int] = None, @@ -1536,10 +1559,6 @@ async def change_lease( # pylint: disable=inconsistent-return-statements """[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. - :param comp: comp. "lease" Required. - :type comp: str or ~azure.storage.blob.models.Enum16 - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param proposed_lease_id: Proposed lease ID, in a GUID string format. The Blob service returns @@ -1557,6 +1576,12 @@ async def change_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword action: Describes what lease action to take. Default value is "change". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1574,8 +1599,10 @@ async def change_lease( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1587,16 +1614,16 @@ async def change_lease( # pylint: disable=inconsistent-return-statements request = build_change_lease_request( url=self._config.url, - comp=comp, - restype=restype, lease_id=lease_id, proposed_lease_id=proposed_lease_id, - version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, + comp=comp, + restype=restype, action=action, + version=self._config.version, template_url=self.change_lease.metadata["url"], headers=_headers, params=_params, @@ -1634,8 +1661,6 @@ async def change_lease( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def list_blob_flat_segment( self, - restype: Union[str, _models.Enum11], - comp: Union[str, _models.Enum5], prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, @@ -1646,10 +1671,6 @@ async def list_blob_flat_segment( ) -> _models.ListBlobsFlatSegmentResponse: """[Update] The List Blobs operation returns a list of the blobs under the specified container. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 - :param comp: comp. "list" Required. - :type comp: str or ~azure.storage.blob.models.Enum5 :param prefix: Filters the results to return only containers whose name begins with the specified prefix. Default value is None. :type prefix: str @@ -1679,6 +1700,12 @@ async def list_blob_flat_segment( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "list". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListBlobsFlatSegmentResponse or the result of cls(response) :rtype: ~azure.storage.blob.models.ListBlobsFlatSegmentResponse @@ -1693,21 +1720,23 @@ async def list_blob_flat_segment( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) + comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) cls: ClsType[_models.ListBlobsFlatSegmentResponse] = kwargs.pop("cls", None) request = build_list_blob_flat_segment_request( url=self._config.url, - restype=restype, - comp=comp, - version=self._config.version, prefix=prefix, marker=marker, maxresults=maxresults, include=include, timeout=timeout, request_id_parameter=request_id_parameter, + restype=restype, + comp=comp, + version=self._config.version, template_url=self.list_blob_flat_segment.metadata["url"], headers=_headers, params=_params, @@ -1747,8 +1776,6 @@ async def list_blob_flat_segment( @distributed_trace_async async def list_blob_hierarchy_segment( self, - restype: Union[str, _models.Enum11], - comp: Union[str, _models.Enum5], delimiter: str, prefix: Optional[str] = None, marker: Optional[str] = None, @@ -1760,10 +1787,6 @@ async def list_blob_hierarchy_segment( ) -> _models.ListBlobsHierarchySegmentResponse: """[Update] The List Blobs operation returns a list of the blobs under the specified container. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 - :param comp: comp. "list" Required. - :type comp: str or ~azure.storage.blob.models.Enum5 :param delimiter: When the request includes this parameter, the operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may be a @@ -1798,6 +1821,12 @@ async def list_blob_hierarchy_segment( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "list". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListBlobsHierarchySegmentResponse or the result of cls(response) :rtype: ~azure.storage.blob.models.ListBlobsHierarchySegmentResponse @@ -1812,22 +1841,24 @@ async def list_blob_hierarchy_segment( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) + comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) cls: ClsType[_models.ListBlobsHierarchySegmentResponse] = kwargs.pop("cls", None) request = build_list_blob_hierarchy_segment_request( url=self._config.url, - restype=restype, - comp=comp, delimiter=delimiter, - version=self._config.version, prefix=prefix, marker=marker, maxresults=maxresults, include=include, timeout=timeout, request_id_parameter=request_id_parameter, + restype=restype, + comp=comp, + version=self._config.version, template_url=self.list_blob_hierarchy_segment.metadata["url"], headers=_headers, params=_params, @@ -1865,15 +1896,15 @@ async def list_blob_hierarchy_segment( list_blob_hierarchy_segment.metadata = {"url": "{url}/{containerName}"} @distributed_trace_async - async def get_account_info( # pylint: disable=inconsistent-return-statements - self, restype: Union[str, _models.Enum8], comp: Union[str, _models.Enum1], **kwargs: Any - ) -> None: + async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements """Returns the sku name and account kind. - :param restype: restype. "account" Required. - :type restype: str or ~azure.storage.blob.models.Enum8 - :param comp: comp. "properties" Required. - :type comp: str or ~azure.storage.blob.models.Enum1 + :keyword restype: restype. Default value is "account". Note that overriding this default value + may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -1888,8 +1919,10 @@ async def get_account_info( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account")) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_get_account_info_request( diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py index a9627459eadd..dee8c287bc53 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py @@ -203,7 +203,6 @@ async def create( # pylint: disable=inconsistent-return-statements url=self._config.url, content_length=content_length, blob_content_length=blob_content_length, - version=self._config.version, timeout=timeout, tier=tier, blob_content_type=_blob_content_type, @@ -230,6 +229,7 @@ async def create( # pylint: disable=inconsistent-return-statements immutability_policy_mode=immutability_policy_mode, legal_hold=legal_hold, blob_type=blob_type, + version=self._config.version, template_url=self.create.metadata["url"], headers=_headers, params=_params, @@ -277,7 +277,6 @@ async def create( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def upload_pages( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum34], content_length: int, body: IO, transactional_content_md5: Optional[bytes] = None, @@ -294,8 +293,6 @@ async def upload_pages( # pylint: disable=inconsistent-return-statements ) -> None: """The Upload Pages operation writes a range of pages to a page blob. - :param comp: comp. "page" Required. - :type comp: str or ~azure.storage.blob.models.Enum34 :param content_length: The length of the request. Required. :type content_length: int :param body: Initial data. Required. @@ -328,6 +325,9 @@ async def upload_pages( # pylint: disable=inconsistent-return-statements ~azure.storage.blob.models.SequenceNumberAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "page". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword page_write: Required. You may specify one of the following options: @@ -352,8 +352,9 @@ async def upload_pages( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page")) page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -395,9 +396,7 @@ async def upload_pages( # pylint: disable=inconsistent-return-statements request = build_upload_pages_request( url=self._config.url, - comp=comp, content_length=content_length, - version=self._config.version, transactional_content_md5=transactional_content_md5, transactional_content_crc64=transactional_content_crc64, timeout=timeout, @@ -416,8 +415,10 @@ async def upload_pages( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, page_write=page_write, content_type=content_type, + version=self._config.version, content=_content, template_url=self.upload_pages.metadata["url"], headers=_headers, @@ -471,7 +472,6 @@ async def upload_pages( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def clear_pages( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum34], content_length: int, timeout: Optional[int] = None, range: Optional[str] = None, @@ -485,8 +485,6 @@ async def clear_pages( # pylint: disable=inconsistent-return-statements ) -> None: """The Clear Pages operation clears a set of pages from a page blob. - :param comp: comp. "page" Required. - :type comp: str or ~azure.storage.blob.models.Enum34 :param content_length: The length of the request. Required. :type content_length: int :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -511,6 +509,9 @@ async def clear_pages( # pylint: disable=inconsistent-return-statements ~azure.storage.blob.models.SequenceNumberAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "page". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword page_write: Required. You may specify one of the following options: @@ -535,8 +536,9 @@ async def clear_pages( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page")) page_write: Literal["clear"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "clear")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -576,9 +578,7 @@ async def clear_pages( # pylint: disable=inconsistent-return-statements request = build_clear_pages_request( url=self._config.url, - comp=comp, content_length=content_length, - version=self._config.version, timeout=timeout, range=range, lease_id=_lease_id, @@ -595,7 +595,9 @@ async def clear_pages( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, page_write=page_write, + version=self._config.version, template_url=self.clear_pages.metadata["url"], headers=_headers, params=_params, @@ -639,7 +641,6 @@ async def clear_pages( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def upload_pages_from_url( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum34], source_url: str, source_range: str, content_length: int, @@ -660,8 +661,6 @@ async def upload_pages_from_url( # pylint: disable=inconsistent-return-statemen """The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL. - :param comp: comp. "page" Required. - :type comp: str or ~azure.storage.blob.models.Enum34 :param source_url: Specify a URL to the copy source. Required. :type source_url: str :param source_range: Bytes of source data in the specified range. The length of this range @@ -704,6 +703,9 @@ async def upload_pages_from_url( # pylint: disable=inconsistent-return-statemen :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions + :keyword comp: comp. Default value is "page". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword page_write: Required. You may specify one of the following options: @@ -728,8 +730,9 @@ async def upload_pages_from_url( # pylint: disable=inconsistent-return-statemen error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page")) page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -778,12 +781,10 @@ async def upload_pages_from_url( # pylint: disable=inconsistent-return-statemen request = build_upload_pages_from_url_request( url=self._config.url, - comp=comp, source_url=source_url, source_range=source_range, content_length=content_length, range=range, - version=self._config.version, source_content_md5=source_content_md5, source_contentcrc64=source_contentcrc64, timeout=timeout, @@ -806,7 +807,9 @@ async def upload_pages_from_url( # pylint: disable=inconsistent-return-statemen source_if_none_match=_source_if_none_match, request_id_parameter=request_id_parameter, copy_source_authorization=copy_source_authorization, + comp=comp, page_write=page_write, + version=self._config.version, template_url=self.upload_pages_from_url.metadata["url"], headers=_headers, params=_params, @@ -856,7 +859,6 @@ async def upload_pages_from_url( # pylint: disable=inconsistent-return-statemen @distributed_trace_async async def get_page_ranges( self, - comp: Union[str, _models.Enum35], snapshot: Optional[str] = None, timeout: Optional[int] = None, range: Optional[str] = None, @@ -870,8 +872,6 @@ async def get_page_ranges( """The Get Page Ranges operation returns the list of valid page ranges for a page blob or snapshot of a page blob. - :param comp: comp. "pagelist" Required. - :type comp: str or ~azure.storage.blob.models.Enum35 :param snapshot: The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:` None: """Resize the Blob. - :param comp: comp. "properties" Required. - :type comp: str or ~azure.storage.blob.models.Enum1 :param blob_content_length: This header specifies the maximum size for the page blob, up to 1 TB. The page blob size must be aligned to a 512-byte boundary. Required. :type blob_content_length: int @@ -1192,6 +1194,9 @@ async def resize( # pylint: disable=inconsistent-return-statements :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -1206,8 +1211,9 @@ async def resize( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None @@ -1237,9 +1243,7 @@ async def resize( # pylint: disable=inconsistent-return-statements request = build_resize_request( url=self._config.url, - comp=comp, blob_content_length=blob_content_length, - version=self._config.version, timeout=timeout, lease_id=_lease_id, encryption_key=_encryption_key, @@ -1252,6 +1256,8 @@ async def resize( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, + version=self._config.version, template_url=self.resize.metadata["url"], headers=_headers, params=_params, @@ -1291,7 +1297,6 @@ async def resize( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def update_sequence_number( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum1], sequence_number_action: Union[str, _models.SequenceNumberActionType], timeout: Optional[int] = None, blob_sequence_number: int = 0, @@ -1302,8 +1307,6 @@ async def update_sequence_number( # pylint: disable=inconsistent-return-stateme ) -> None: """Update the sequence number of the blob. - :param comp: comp. "properties" Required. - :type comp: str or ~azure.storage.blob.models.Enum1 :param sequence_number_action: Required if the x-ms-blob-sequence-number header is set for the request. This property applies to page blobs only. This property indicates how the service should modify the blob's sequence number. Known values are: "max", "update", and "increment". @@ -1326,6 +1329,9 @@ async def update_sequence_number( # pylint: disable=inconsistent-return-stateme :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -1340,8 +1346,9 @@ async def update_sequence_number( # pylint: disable=inconsistent-return-stateme error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None @@ -1361,9 +1368,7 @@ async def update_sequence_number( # pylint: disable=inconsistent-return-stateme request = build_update_sequence_number_request( url=self._config.url, - comp=comp, sequence_number_action=sequence_number_action, - version=self._config.version, timeout=timeout, lease_id=_lease_id, if_modified_since=_if_modified_since, @@ -1373,6 +1378,8 @@ async def update_sequence_number( # pylint: disable=inconsistent-return-stateme if_tags=_if_tags, blob_sequence_number=blob_sequence_number, request_id_parameter=request_id_parameter, + comp=comp, + version=self._config.version, template_url=self.update_sequence_number.metadata["url"], headers=_headers, params=_params, @@ -1412,7 +1419,6 @@ async def update_sequence_number( # pylint: disable=inconsistent-return-stateme @distributed_trace_async async def copy_incremental( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum36], copy_source: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -1425,8 +1431,6 @@ async def copy_incremental( # pylint: disable=inconsistent-return-statements the original snapshot and can be read or copied from as usual. This API is supported since REST version 2016-05-31. - :param comp: comp. "incrementalcopy" Required. - :type comp: str or ~azure.storage.blob.models.Enum36 :param copy_source: Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated @@ -1443,6 +1447,9 @@ async def copy_incremental( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "incrementalcopy". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -1457,8 +1464,9 @@ async def copy_incremental( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["incrementalcopy"] = kwargs.pop("comp", _params.pop("comp", "incrementalcopy")) cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None @@ -1475,9 +1483,7 @@ async def copy_incremental( # pylint: disable=inconsistent-return-statements request = build_copy_incremental_request( url=self._config.url, - comp=comp, copy_source=copy_source, - version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, @@ -1485,6 +1491,8 @@ async def copy_incremental( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, + version=self._config.version, template_url=self.copy_incremental.metadata["url"], headers=_headers, params=_params, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py index daf08ab28c8d..2e5c4f79cdeb 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_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. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_submit_batch_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,8 +66,6 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace_async async def set_properties( # pylint: disable=inconsistent-return-statements self, - restype: Union[str, _models.Enum0], - comp: Union[str, _models.Enum1], storage_service_properties: _models.StorageServiceProperties, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -71,10 +74,6 @@ async def set_properties( # pylint: disable=inconsistent-return-statements """Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. - :param restype: restype. "service" Required. - :type restype: str or ~azure.storage.blob.models.Enum0 - :param comp: comp. "properties" Required. - :type comp: str or ~azure.storage.blob.models.Enum1 :param storage_service_properties: The StorageService properties. Required. :type storage_service_properties: ~azure.storage.blob.models.StorageServiceProperties :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -86,6 +85,12 @@ async def set_properties( # pylint: disable=inconsistent-return-statements limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword restype: restype. Default value is "service". Note that overriding this default value + may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -100,8 +105,10 @@ async def set_properties( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -109,12 +116,12 @@ async def set_properties( # pylint: disable=inconsistent-return-statements request = build_set_properties_request( url=self._config.url, - restype=restype, - comp=comp, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, + restype=restype, + comp=comp, content_type=content_type, + version=self._config.version, content=_content, template_url=self.set_properties.metadata["url"], headers=_headers, @@ -148,20 +155,11 @@ async def set_properties( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def get_properties( - self, - restype: Union[str, _models.Enum0], - comp: Union[str, _models.Enum1], - timeout: Optional[int] = None, - request_id_parameter: Optional[str] = None, - **kwargs: Any + self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> _models.StorageServiceProperties: """gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. - :param restype: restype. "service" Required. - :type restype: str or ~azure.storage.blob.models.Enum0 - :param comp: comp. "properties" Required. - :type comp: str or ~azure.storage.blob.models.Enum1 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -171,6 +169,12 @@ async def get_properties( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword restype: restype. Default value is "service". Note that overriding this default value + may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceProperties or the result of cls(response) :rtype: ~azure.storage.blob.models.StorageServiceProperties @@ -185,17 +189,19 @@ async def get_properties( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) cls: ClsType[_models.StorageServiceProperties] = kwargs.pop("cls", None) request = build_get_properties_request( url=self._config.url, + timeout=timeout, + request_id_parameter=request_id_parameter, restype=restype, comp=comp, version=self._config.version, - timeout=timeout, - request_id_parameter=request_id_parameter, template_url=self.get_properties.metadata["url"], headers=_headers, params=_params, @@ -232,21 +238,12 @@ async def get_properties( @distributed_trace_async async def get_statistics( - self, - restype: Union[str, _models.Enum0], - comp: Union[str, _models.Enum3], - timeout: Optional[int] = None, - request_id_parameter: Optional[str] = None, - **kwargs: Any + self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> _models.StorageServiceStats: """Retrieves statistics related to replication for the Blob service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account. - :param restype: restype. "service" Required. - :type restype: str or ~azure.storage.blob.models.Enum0 - :param comp: comp. "stats" Required. - :type comp: str or ~azure.storage.blob.models.Enum3 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -256,6 +253,12 @@ async def get_statistics( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword restype: restype. Default value is "service". Note that overriding this default value + may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "stats". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceStats or the result of cls(response) :rtype: ~azure.storage.blob.models.StorageServiceStats @@ -270,17 +273,19 @@ async def get_statistics( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) + comp: Literal["stats"] = kwargs.pop("comp", _params.pop("comp", "stats")) cls: ClsType[_models.StorageServiceStats] = kwargs.pop("cls", None) request = build_get_statistics_request( url=self._config.url, + timeout=timeout, + request_id_parameter=request_id_parameter, restype=restype, comp=comp, version=self._config.version, - timeout=timeout, - request_id_parameter=request_id_parameter, template_url=self.get_statistics.metadata["url"], headers=_headers, params=_params, @@ -319,7 +324,6 @@ async def get_statistics( @distributed_trace_async async def list_containers_segment( self, - comp: Union[str, _models.Enum5], prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, @@ -331,8 +335,6 @@ async def list_containers_segment( """The List Containers Segment operation returns a list of the containers under the specified account. - :param comp: comp. "list" Required. - :type comp: str or ~azure.storage.blob.models.Enum5 :param prefix: Filters the results to return only containers whose name begins with the specified prefix. Default value is None. :type prefix: str @@ -362,6 +364,9 @@ async def list_containers_segment( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword comp: comp. Default value is "list". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListContainersSegmentResponse or the result of cls(response) :rtype: ~azure.storage.blob.models.ListContainersSegmentResponse @@ -376,20 +381,21 @@ async def list_containers_segment( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) cls: ClsType[_models.ListContainersSegmentResponse] = kwargs.pop("cls", None) request = build_list_containers_segment_request( url=self._config.url, - comp=comp, - version=self._config.version, prefix=prefix, marker=marker, maxresults=maxresults, include=include, timeout=timeout, request_id_parameter=request_id_parameter, + comp=comp, + version=self._config.version, template_url=self.list_containers_segment.metadata["url"], headers=_headers, params=_params, @@ -427,8 +433,6 @@ async def list_containers_segment( @distributed_trace_async async def get_user_delegation_key( self, - restype: Union[str, _models.Enum0], - comp: Union[str, _models.Enum7], key_info: _models.KeyInfo, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -437,10 +441,6 @@ async def get_user_delegation_key( """Retrieves a user delegation key for the Blob service. This is only a valid operation when using bearer token authentication. - :param restype: restype. "service" Required. - :type restype: str or ~azure.storage.blob.models.Enum0 - :param comp: comp. "userdelegationkey" Required. - :type comp: str or ~azure.storage.blob.models.Enum7 :param key_info: Key information. Required. :type key_info: ~azure.storage.blob.models.KeyInfo :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -452,6 +452,12 @@ async def get_user_delegation_key( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword restype: restype. Default value is "service". Note that overriding this default value + may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "userdelegationkey". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: UserDelegationKey or the result of cls(response) :rtype: ~azure.storage.blob.models.UserDelegationKey @@ -466,8 +472,10 @@ async def get_user_delegation_key( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) + comp: Literal["userdelegationkey"] = kwargs.pop("comp", _params.pop("comp", "userdelegationkey")) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) cls: ClsType[_models.UserDelegationKey] = kwargs.pop("cls", None) @@ -475,12 +483,12 @@ async def get_user_delegation_key( request = build_get_user_delegation_key_request( url=self._config.url, - restype=restype, - comp=comp, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, + restype=restype, + comp=comp, content_type=content_type, + version=self._config.version, content=_content, template_url=self.get_user_delegation_key.metadata["url"], headers=_headers, @@ -518,15 +526,15 @@ async def get_user_delegation_key( get_user_delegation_key.metadata = {"url": "{url}"} @distributed_trace_async - async def get_account_info( # pylint: disable=inconsistent-return-statements - self, restype: Union[str, _models.Enum8], comp: Union[str, _models.Enum1], **kwargs: Any - ) -> None: + async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements """Returns the sku name and account kind. - :param restype: restype. "account" Required. - :type restype: str or ~azure.storage.blob.models.Enum8 - :param comp: comp. "properties" Required. - :type comp: str or ~azure.storage.blob.models.Enum1 + :keyword restype: restype. Default value is "account". Note that overriding this default value + may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -541,8 +549,10 @@ async def get_account_info( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account")) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_get_account_info_request( @@ -587,7 +597,6 @@ async def get_account_info( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def submit_batch( self, - comp: Union[str, _models.Enum9], content_length: int, body: IO, timeout: Optional[int] = None, @@ -596,8 +605,6 @@ async def submit_batch( ) -> AsyncIterator[bytes]: """The Batch operation allows multiple API calls to be embedded into a single HTTP request. - :param comp: comp. "batch" Required. - :type comp: str or ~azure.storage.blob.models.Enum9 :param content_length: The length of the request. Required. :type content_length: int :param body: Initial data. Required. @@ -611,6 +618,9 @@ async def submit_batch( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword comp: comp. Default value is "batch". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Async iterator of the response bytes or the result of cls(response) :rtype: AsyncIterator[bytes] @@ -625,8 +635,9 @@ async def submit_batch( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["batch"] = kwargs.pop("comp", _params.pop("comp", "batch")) multipart_content_type: str = kwargs.pop( "multipart_content_type", _headers.pop("Content-Type", "application/xml") ) @@ -636,12 +647,12 @@ async def submit_batch( request = build_submit_batch_request( url=self._config.url, - comp=comp, content_length=content_length, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, + comp=comp, multipart_content_type=multipart_content_type, + version=self._config.version, content=_content, template_url=self.submit_batch.metadata["url"], headers=_headers, @@ -678,7 +689,6 @@ async def submit_batch( @distributed_trace_async async def filter_blobs( self, - comp: Union[str, _models.Enum10], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, where: Optional[str] = None, @@ -691,8 +701,6 @@ async def filter_blobs( a given search expression. Filter blobs searches across all containers within a storage account but can be scoped within the expression to a single container. - :param comp: comp. "blobs" Required. - :type comp: str or ~azure.storage.blob.models.Enum10 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -722,6 +730,9 @@ async def filter_blobs( :param include: Include this parameter to specify one or more datasets to include in the response. Default value is None. :type include: list[str or ~azure.storage.blob.models.FilterBlobsIncludeItem] + :keyword comp: comp. Default value is "blobs". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FilterBlobSegment or the result of cls(response) :rtype: ~azure.storage.blob.models.FilterBlobSegment @@ -736,20 +747,21 @@ async def filter_blobs( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["blobs"] = kwargs.pop("comp", _params.pop("comp", "blobs")) cls: ClsType[_models.FilterBlobSegment] = kwargs.pop("cls", None) request = build_filter_blobs_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, where=where, marker=marker, maxresults=maxresults, include=include, + comp=comp, + version=self._config.version, template_url=self.filter_blobs.metadata["url"], headers=_headers, params=_params, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/__init__.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/__init__.py index f6db59126353..63ca7e23fc24 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/__init__.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/__init__.py @@ -71,38 +71,6 @@ from ._azure_blob_storage_enums import CopyStatusType from ._azure_blob_storage_enums import DeleteSnapshotsOptionType from ._azure_blob_storage_enums import EncryptionAlgorithmType -from ._azure_blob_storage_enums import Enum0 -from ._azure_blob_storage_enums import Enum1 -from ._azure_blob_storage_enums import Enum10 -from ._azure_blob_storage_enums import Enum11 -from ._azure_blob_storage_enums import Enum12 -from ._azure_blob_storage_enums import Enum13 -from ._azure_blob_storage_enums import Enum14 -from ._azure_blob_storage_enums import Enum15 -from ._azure_blob_storage_enums import Enum16 -from ._azure_blob_storage_enums import Enum2 -from ._azure_blob_storage_enums import Enum22 -from ._azure_blob_storage_enums import Enum24 -from ._azure_blob_storage_enums import Enum25 -from ._azure_blob_storage_enums import Enum26 -from ._azure_blob_storage_enums import Enum27 -from ._azure_blob_storage_enums import Enum28 -from ._azure_blob_storage_enums import Enum29 -from ._azure_blob_storage_enums import Enum3 -from ._azure_blob_storage_enums import Enum30 -from ._azure_blob_storage_enums import Enum32 -from ._azure_blob_storage_enums import Enum33 -from ._azure_blob_storage_enums import Enum34 -from ._azure_blob_storage_enums import Enum35 -from ._azure_blob_storage_enums import Enum36 -from ._azure_blob_storage_enums import Enum37 -from ._azure_blob_storage_enums import Enum38 -from ._azure_blob_storage_enums import Enum39 -from ._azure_blob_storage_enums import Enum41 -from ._azure_blob_storage_enums import Enum5 -from ._azure_blob_storage_enums import Enum7 -from ._azure_blob_storage_enums import Enum8 -from ._azure_blob_storage_enums import Enum9 from ._azure_blob_storage_enums import FilterBlobsIncludeItem from ._azure_blob_storage_enums import GeoReplicationStatusType from ._azure_blob_storage_enums import LeaseDurationType @@ -113,7 +81,6 @@ from ._azure_blob_storage_enums import PremiumPageBlobAccessTier from ._azure_blob_storage_enums import PublicAccessType from ._azure_blob_storage_enums import QueryFormatType -from ._azure_blob_storage_enums import QueryRequestQueryType from ._azure_blob_storage_enums import RehydratePriority from ._azure_blob_storage_enums import SequenceNumberActionType from ._azure_blob_storage_enums import SkuName @@ -187,38 +154,6 @@ "CopyStatusType", "DeleteSnapshotsOptionType", "EncryptionAlgorithmType", - "Enum0", - "Enum1", - "Enum10", - "Enum11", - "Enum12", - "Enum13", - "Enum14", - "Enum15", - "Enum16", - "Enum2", - "Enum22", - "Enum24", - "Enum25", - "Enum26", - "Enum27", - "Enum28", - "Enum29", - "Enum3", - "Enum30", - "Enum32", - "Enum33", - "Enum34", - "Enum35", - "Enum36", - "Enum37", - "Enum38", - "Enum39", - "Enum41", - "Enum5", - "Enum7", - "Enum8", - "Enum9", "FilterBlobsIncludeItem", "GeoReplicationStatusType", "LeaseDurationType", @@ -229,7 +164,6 @@ "PremiumPageBlobAccessTier", "PublicAccessType", "QueryFormatType", - "QueryRequestQueryType", "RehydratePriority", "SequenceNumberActionType", "SkuName", diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_azure_blob_storage_enums.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_azure_blob_storage_enums.py index a9a485527be3..c8aaca620fb2 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_azure_blob_storage_enums.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_azure_blob_storage_enums.py @@ -151,198 +151,6 @@ class EncryptionAlgorithmType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AES256 = "AES256" -class Enum0(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum0.""" - - SERVICE = "service" - - -class Enum1(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum1.""" - - PROPERTIES = "properties" - - -class Enum10(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum10.""" - - BLOBS = "blobs" - - -class Enum11(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum11.""" - - CONTAINER = "container" - - -class Enum12(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum12.""" - - METADATA = "metadata" - - -class Enum13(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum13.""" - - ACL = "acl" - - -class Enum14(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum14.""" - - UNDELETE = "undelete" - - -class Enum15(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum15.""" - - RENAME = "rename" - - -class Enum16(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum16.""" - - LEASE = "lease" - - -class Enum2(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum2.""" - - TWO_THOUSAND_TWENTY_ONE12_02 = "2021-12-02" - - -class Enum22(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum22.""" - - EXPIRY = "expiry" - - -class Enum24(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum24.""" - - IMMUTABILITY_POLICIES = "immutabilityPolicies" - - -class Enum25(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum25.""" - - LEGALHOLD = "legalhold" - - -class Enum26(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum26.""" - - SNAPSHOT = "snapshot" - - -class Enum27(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum27.""" - - TRUE = "true" - - -class Enum28(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum28.""" - - COPY = "copy" - - -class Enum29(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum29.""" - - ABORT = "abort" - - -class Enum3(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum3.""" - - STATS = "stats" - - -class Enum30(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum30.""" - - TIER = "tier" - - -class Enum32(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum32.""" - - BLOCK = "block" - - -class Enum33(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum33.""" - - BLOCKLIST = "blocklist" - - -class Enum34(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum34.""" - - PAGE = "page" - - -class Enum35(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum35.""" - - PAGELIST = "pagelist" - - -class Enum36(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum36.""" - - INCREMENTALCOPY = "incrementalcopy" - - -class Enum37(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum37.""" - - APPENDBLOCK = "appendblock" - - -class Enum38(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum38.""" - - SEAL = "seal" - - -class Enum39(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum39.""" - - QUERY = "query" - - -class Enum41(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum41.""" - - TAGS = "tags" - - -class Enum5(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum5.""" - - LIST = "list" - - -class Enum7(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum7.""" - - USERDELEGATIONKEY = "userdelegationkey" - - -class Enum8(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum8.""" - - ACCOUNT = "account" - - -class Enum9(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum9.""" - - BATCH = "batch" - - class FilterBlobsIncludeItem(str, Enum, metaclass=CaseInsensitiveEnumMeta): """FilterBlobsIncludeItem.""" @@ -437,12 +245,6 @@ class QueryFormatType(str, Enum, metaclass=CaseInsensitiveEnumMeta): PARQUET = "parquet" -class QueryRequestQueryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Required. The type of the provided query expression.""" - - SQL = "SQL" - - class RehydratePriority(str, Enum, metaclass=CaseInsensitiveEnumMeta): """If an object is in rehydrate pending state then this header is returned with priority of rehydrate. Valid values are High and Standard. diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py index 06fb39ab4520..cdc978a49f17 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py @@ -2251,10 +2251,13 @@ def __init__( class QueryRequest(_serialization.Model): """Groups the set of query request settings. + 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 query_type: Required. The type of the provided query expression. Required. "SQL" - :vartype query_type: str or ~azure.storage.blob.models.QueryRequestQueryType + :ivar query_type: Required. The type of the provided query expression. Required. Default value + is "SQL". + :vartype query_type: str :ivar expression: The query expression in SQL. The maximum size of the query expression is 256KiB. Required. :vartype expression: str @@ -2265,7 +2268,7 @@ class QueryRequest(_serialization.Model): """ _validation = { - "query_type": {"required": True}, + "query_type": {"required": True, "constant": True}, "expression": {"required": True}, } @@ -2277,18 +2280,17 @@ class QueryRequest(_serialization.Model): } _xml_map = {"name": "QueryRequest"} + query_type = "SQL" + def __init__( self, *, - query_type: Union[str, "_models.QueryRequestQueryType"], expression: str, input_serialization: Optional["_models.QuerySerialization"] = None, output_serialization: Optional["_models.QuerySerialization"] = None, **kwargs: Any ) -> None: """ - :keyword query_type: Required. The type of the provided query expression. Required. "SQL" - :paramtype query_type: str or ~azure.storage.blob.models.QueryRequestQueryType :keyword expression: The query expression in SQL. The maximum size of the query expression is 256KiB. Required. :paramtype expression: str @@ -2298,7 +2300,6 @@ def __init__( :paramtype output_serialization: ~azure.storage.blob.models.QuerySerialization """ super().__init__(**kwargs) - self.query_type = query_type self.expression = expression self.input_serialization = input_serialization self.output_serialization = output_serialization diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py index 8a6eebc8cf79..284a9de13a95 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py @@ -43,7 +43,6 @@ def build_create_request( url: str, *, content_length: int, - version: Union[str, _models.Enum2], timeout: Optional[int] = None, blob_content_type: Optional[str] = None, blob_content_encoding: Optional[str] = None, @@ -73,6 +72,7 @@ def build_create_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) blob_type: Literal["AppendBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "AppendBlob")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -155,10 +155,8 @@ def build_create_request( def build_append_block_request( url: str, *, - comp: Union[str, _models.Enum37], content_length: int, content: IO, - version: Union[str, _models.Enum2], timeout: Optional[int] = None, transactional_content_md5: Optional[bytes] = None, transactional_content_crc64: Optional[bytes] = None, @@ -180,7 +178,9 @@ def build_append_block_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["appendblock"] = kwargs.pop("comp", _params.pop("comp", "appendblock")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -245,10 +245,8 @@ def build_append_block_request( def build_append_block_from_url_request( url: str, *, - comp: Union[str, _models.Enum37], source_url: str, content_length: int, - version: Union[str, _models.Enum2], source_range: Optional[str] = None, source_content_md5: Optional[bytes] = None, source_contentcrc64: Optional[bytes] = None, @@ -277,6 +275,8 @@ def build_append_block_from_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["appendblock"] = kwargs.pop("comp", _params.pop("comp", "appendblock")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -360,8 +360,6 @@ def build_append_block_from_url_request( def build_seal_request( url: str, *, - comp: Union[str, _models.Enum38], - version: Union[str, _models.Enum2], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_id: Optional[str] = None, @@ -375,6 +373,8 @@ def build_seal_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["seal"] = kwargs.pop("comp", _params.pop("comp", "seal")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -554,7 +554,6 @@ def create( # pylint: disable=inconsistent-return-statements request = build_create_request( url=self._config.url, content_length=content_length, - version=self._config.version, timeout=timeout, blob_content_type=_blob_content_type, blob_content_encoding=_blob_content_encoding, @@ -579,6 +578,7 @@ def create( # pylint: disable=inconsistent-return-statements immutability_policy_mode=immutability_policy_mode, legal_hold=legal_hold, blob_type=blob_type, + version=self._config.version, template_url=self.create.metadata["url"], headers=_headers, params=_params, @@ -626,7 +626,6 @@ def create( # pylint: disable=inconsistent-return-statements @distributed_trace def append_block( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum37], content_length: int, body: IO, timeout: Optional[int] = None, @@ -644,8 +643,6 @@ def append_block( # pylint: disable=inconsistent-return-statements The Append Block operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. - :param comp: comp. "appendblock" Required. - :type comp: str or ~azure.storage.blob.models.Enum37 :param content_length: The length of the request. Required. :type content_length: int :param body: Initial data. Required. @@ -676,6 +673,9 @@ def append_block( # pylint: disable=inconsistent-return-statements :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "appendblock". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -690,8 +690,9 @@ def append_block( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["appendblock"] = kwargs.pop("comp", _params.pop("comp", "appendblock")) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -728,9 +729,7 @@ def append_block( # pylint: disable=inconsistent-return-statements request = build_append_block_request( url=self._config.url, - comp=comp, content_length=content_length, - version=self._config.version, timeout=timeout, transactional_content_md5=transactional_content_md5, transactional_content_crc64=transactional_content_crc64, @@ -747,7 +746,9 @@ def append_block( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, content_type=content_type, + version=self._config.version, content=_content, template_url=self.append_block.metadata["url"], headers=_headers, @@ -804,7 +805,6 @@ def append_block( # pylint: disable=inconsistent-return-statements @distributed_trace def append_block_from_url( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum37], source_url: str, content_length: int, source_range: Optional[str] = None, @@ -827,8 +827,6 @@ def append_block_from_url( # pylint: disable=inconsistent-return-statements the blob was created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. - :param comp: comp. "appendblock" Required. - :type comp: str or ~azure.storage.blob.models.Enum37 :param source_url: Specify a URL to the copy source. Required. :type source_url: str :param content_length: The length of the request. Required. @@ -870,6 +868,9 @@ def append_block_from_url( # pylint: disable=inconsistent-return-statements :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions + :keyword comp: comp. Default value is "appendblock". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -884,8 +885,9 @@ def append_block_from_url( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["appendblock"] = kwargs.pop("comp", _params.pop("comp", "appendblock")) cls: ClsType[None] = kwargs.pop("cls", None) _encryption_key = None @@ -929,10 +931,8 @@ def append_block_from_url( # pylint: disable=inconsistent-return-statements request = build_append_block_from_url_request( url=self._config.url, - comp=comp, source_url=source_url, content_length=content_length, - version=self._config.version, source_range=source_range, source_content_md5=source_content_md5, source_contentcrc64=source_contentcrc64, @@ -956,6 +956,8 @@ def append_block_from_url( # pylint: disable=inconsistent-return-statements source_if_none_match=_source_if_none_match, request_id_parameter=request_id_parameter, copy_source_authorization=copy_source_authorization, + comp=comp, + version=self._config.version, template_url=self.append_block_from_url.metadata["url"], headers=_headers, params=_params, @@ -1008,7 +1010,6 @@ def append_block_from_url( # pylint: disable=inconsistent-return-statements @distributed_trace def seal( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum38], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -1019,8 +1020,6 @@ def seal( # pylint: disable=inconsistent-return-statements """The Seal operation seals the Append Blob to make it read-only. Seal is supported only on version 2019-12-12 version or later. - :param comp: comp. "seal" Required. - :type comp: str or ~azure.storage.blob.models.Enum38 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1037,6 +1036,9 @@ def seal( # pylint: disable=inconsistent-return-statements :param append_position_access_conditions: Parameter group. Default value is None. :type append_position_access_conditions: ~azure.storage.blob.models.AppendPositionAccessConditions + :keyword comp: comp. Default value is "seal". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -1051,8 +1053,9 @@ def seal( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["seal"] = kwargs.pop("comp", _params.pop("comp", "seal")) cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None @@ -1073,8 +1076,6 @@ def seal( # pylint: disable=inconsistent-return-statements request = build_seal_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, lease_id=_lease_id, @@ -1083,6 +1084,8 @@ def seal( # pylint: disable=inconsistent-return-statements if_match=_if_match, if_none_match=_if_none_match, append_position=_append_position, + comp=comp, + version=self._config.version, template_url=self.seal.metadata["url"], headers=_headers, params=_params, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py index a655a5b91e11..23eade967337 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py @@ -42,7 +42,6 @@ def build_download_request( url: str, *, - version: Union[str, _models.Enum2], snapshot: Optional[str] = None, version_id: Optional[str] = None, timeout: Optional[int] = None, @@ -64,6 +63,7 @@ def build_download_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -124,7 +124,6 @@ def build_download_request( def build_get_properties_request( url: str, *, - version: Union[str, _models.Enum2], snapshot: Optional[str] = None, version_id: Optional[str] = None, timeout: Optional[int] = None, @@ -143,6 +142,7 @@ def build_get_properties_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -193,7 +193,6 @@ def build_get_properties_request( def build_delete_request( url: str, *, - version: Union[str, _models.Enum2], snapshot: Optional[str] = None, version_id: Optional[str] = None, timeout: Optional[int] = None, @@ -211,6 +210,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -255,17 +255,13 @@ def build_delete_request( def build_undelete_request( - url: str, - *, - comp: Union[str, _models.Enum14], - version: Union[str, _models.Enum2], - timeout: Optional[int] = None, - request_id_parameter: Optional[str] = None, - **kwargs: Any + url: str, *, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["undelete"] = kwargs.pop("comp", _params.pop("comp", "undelete")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -293,9 +289,7 @@ def build_undelete_request( def build_set_expiry_request( url: str, *, - comp: Union[str, _models.Enum22], expiry_options: Union[str, _models.BlobExpiryOptions], - version: Union[str, _models.Enum2], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, expires_on: Optional[str] = None, @@ -304,6 +298,8 @@ def build_set_expiry_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["expiry"] = kwargs.pop("comp", _params.pop("comp", "expiry")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -334,8 +330,6 @@ def build_set_expiry_request( def build_set_http_headers_request( url: str, *, - comp: Union[str, _models.Enum1], - version: Union[str, _models.Enum2], timeout: Optional[int] = None, blob_cache_control: Optional[str] = None, blob_content_type: Optional[str] = None, @@ -355,6 +349,8 @@ def build_set_http_headers_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -412,8 +408,6 @@ def build_set_http_headers_request( def build_set_immutability_policy_request( url: str, *, - comp: Union[str, _models.Enum24], - version: Union[str, _models.Enum2], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -424,6 +418,8 @@ def build_set_immutability_policy_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["immutabilityPolicies"] = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -459,17 +455,13 @@ def build_set_immutability_policy_request( def build_delete_immutability_policy_request( - url: str, - *, - comp: Union[str, _models.Enum24], - version: Union[str, _models.Enum2], - timeout: Optional[int] = None, - request_id_parameter: Optional[str] = None, - **kwargs: Any + url: str, *, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["immutabilityPolicies"] = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -497,9 +489,7 @@ def build_delete_immutability_policy_request( def build_set_legal_hold_request( url: str, *, - comp: Union[str, _models.Enum25], legal_hold: bool, - version: Union[str, _models.Enum2], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any @@ -507,6 +497,8 @@ def build_set_legal_hold_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["legalhold"] = kwargs.pop("comp", _params.pop("comp", "legalhold")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -535,8 +527,6 @@ def build_set_legal_hold_request( def build_set_metadata_request( url: str, *, - comp: Union[str, _models.Enum12], - version: Union[str, _models.Enum2], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, lease_id: Optional[str] = None, @@ -555,6 +545,8 @@ def build_set_metadata_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -606,8 +598,6 @@ def build_set_metadata_request( def build_acquire_lease_request( url: str, *, - comp: Union[str, _models.Enum16], - version: Union[str, _models.Enum2], timeout: Optional[int] = None, duration: Optional[int] = None, proposed_lease_id: Optional[str] = None, @@ -622,7 +612,9 @@ def build_acquire_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -665,9 +657,7 @@ def build_acquire_lease_request( def build_release_lease_request( url: str, *, - comp: Union[str, _models.Enum16], lease_id: str, - version: Union[str, _models.Enum2], timeout: Optional[int] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -680,7 +670,9 @@ def build_release_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -720,9 +712,7 @@ def build_release_lease_request( def build_renew_lease_request( url: str, *, - comp: Union[str, _models.Enum16], lease_id: str, - version: Union[str, _models.Enum2], timeout: Optional[int] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -735,7 +725,9 @@ def build_renew_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -775,10 +767,8 @@ def build_renew_lease_request( def build_change_lease_request( url: str, *, - comp: Union[str, _models.Enum16], lease_id: str, proposed_lease_id: str, - version: Union[str, _models.Enum2], timeout: Optional[int] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -791,7 +781,9 @@ def build_change_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -832,8 +824,6 @@ def build_change_lease_request( def build_break_lease_request( url: str, *, - comp: Union[str, _models.Enum16], - version: Union[str, _models.Enum2], timeout: Optional[int] = None, break_period: Optional[int] = None, if_modified_since: Optional[datetime.datetime] = None, @@ -847,7 +837,9 @@ def build_break_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -888,8 +880,6 @@ def build_break_lease_request( def build_create_snapshot_request( url: str, *, - comp: Union[str, _models.Enum26], - version: Union[str, _models.Enum2], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, encryption_key: Optional[str] = None, @@ -908,6 +898,8 @@ def build_create_snapshot_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["snapshot"] = kwargs.pop("comp", _params.pop("comp", "snapshot")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -960,7 +952,6 @@ def build_start_copy_from_url_request( url: str, *, copy_source: str, - version: Union[str, _models.Enum2], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, tier: Optional[Union[str, _models.AccessTierOptional]] = None, @@ -987,6 +978,7 @@ def build_start_copy_from_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1060,9 +1052,7 @@ def build_start_copy_from_url_request( def build_copy_from_url_request( url: str, *, - x_ms_requires_sync: Union[str, _models.Enum27], copy_source: str, - version: Union[str, _models.Enum2], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, tier: Optional[Union[str, _models.AccessTierOptional]] = None, @@ -1090,6 +1080,8 @@ def build_copy_from_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + x_ms_requires_sync: Literal["true"] = kwargs.pop("x_ms_requires_sync", _headers.pop("x-ms-requires-sync", "true")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1168,10 +1160,7 @@ def build_copy_from_url_request( def build_abort_copy_from_url_request( url: str, *, - comp: Union[str, _models.Enum28], - copy_action_abort_constant: Union[str, _models.Enum29], copy_id: str, - version: Union[str, _models.Enum2], timeout: Optional[int] = None, lease_id: Optional[str] = None, request_id_parameter: Optional[str] = None, @@ -1180,6 +1169,11 @@ def build_abort_copy_from_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["copy"] = kwargs.pop("comp", _params.pop("comp", "copy")) + copy_action_abort_constant: Literal["abort"] = kwargs.pop( + "copy_action_abort_constant", _headers.pop("x-ms-copy-action", "abort") + ) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1211,9 +1205,7 @@ def build_abort_copy_from_url_request( def build_set_tier_request( url: str, *, - comp: Union[str, _models.Enum30], tier: Union[str, _models.AccessTierRequired], - version: Union[str, _models.Enum2], snapshot: Optional[str] = None, version_id: Optional[str] = None, timeout: Optional[int] = None, @@ -1226,6 +1218,8 @@ def build_set_tier_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["tier"] = kwargs.pop("comp", _params.pop("comp", "tier")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1261,17 +1255,13 @@ def build_set_tier_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_account_info_request( - url: str, - *, - restype: Union[str, _models.Enum8], - comp: Union[str, _models.Enum1], - version: Union[str, _models.Enum2], - **kwargs: Any -) -> HttpRequest: +def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account")) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1296,8 +1286,6 @@ def build_get_account_info_request( def build_query_request( url: str, *, - comp: Union[str, _models.Enum39], - version: Union[str, _models.Enum2], snapshot: Optional[str] = None, timeout: Optional[int] = None, lease_id: Optional[str] = None, @@ -1316,7 +1304,9 @@ def build_query_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["query"] = kwargs.pop("comp", _params.pop("comp", "query")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1368,8 +1358,6 @@ def build_query_request( def build_get_tags_request( url: str, *, - comp: Union[str, _models.Enum41], - version: Union[str, _models.Enum2], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, snapshot: Optional[str] = None, @@ -1381,6 +1369,8 @@ def build_get_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["tags"] = kwargs.pop("comp", _params.pop("comp", "tags")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1416,8 +1406,6 @@ def build_get_tags_request( def build_set_tags_request( url: str, *, - comp: Union[str, _models.Enum41], - version: Union[str, _models.Enum2], timeout: Optional[int] = None, version_id: Optional[str] = None, transactional_content_md5: Optional[bytes] = None, @@ -1431,7 +1419,9 @@ def build_set_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["tags"] = kwargs.pop("comp", _params.pop("comp", "tags")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1586,7 +1576,6 @@ def download( request = build_download_request( url=self._config.url, - version=self._config.version, snapshot=snapshot, version_id=version_id, timeout=timeout, @@ -1603,6 +1592,7 @@ def download( if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + version=self._config.version, template_url=self.download.metadata["url"], headers=_headers, params=_params, @@ -1876,7 +1866,6 @@ def get_properties( # pylint: disable=inconsistent-return-statements request = build_get_properties_request( url=self._config.url, - version=self._config.version, snapshot=snapshot, version_id=version_id, timeout=timeout, @@ -1890,6 +1879,7 @@ def get_properties( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + version=self._config.version, template_url=self.get_properties.metadata["url"], headers=_headers, params=_params, @@ -2093,7 +2083,6 @@ def delete( # pylint: disable=inconsistent-return-statements request = build_delete_request( url=self._config.url, - version=self._config.version, snapshot=snapshot, version_id=version_id, timeout=timeout, @@ -2106,6 +2095,7 @@ def delete( # pylint: disable=inconsistent-return-statements if_tags=_if_tags, request_id_parameter=request_id_parameter, blob_delete_type=blob_delete_type, + version=self._config.version, template_url=self.delete.metadata["url"], headers=_headers, params=_params, @@ -2139,16 +2129,10 @@ def delete( # pylint: disable=inconsistent-return-statements @distributed_trace def undelete( # pylint: disable=inconsistent-return-statements - self, - comp: Union[str, _models.Enum14], - timeout: Optional[int] = None, - request_id_parameter: Optional[str] = None, - **kwargs: Any + self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: """Undelete a blob that was previously soft deleted. - :param comp: comp. "undelete" Required. - :type comp: str or ~azure.storage.blob.models.Enum14 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -2158,6 +2142,9 @@ def undelete( # pylint: disable=inconsistent-return-statements limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword comp: comp. Default value is "undelete". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -2172,16 +2159,17 @@ def undelete( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["undelete"] = kwargs.pop("comp", _params.pop("comp", "undelete")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_undelete_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, + comp=comp, + version=self._config.version, template_url=self.undelete.metadata["url"], headers=_headers, params=_params, @@ -2216,7 +2204,6 @@ def undelete( # pylint: disable=inconsistent-return-statements @distributed_trace def set_expiry( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum22], expiry_options: Union[str, _models.BlobExpiryOptions], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -2225,8 +2212,6 @@ def set_expiry( # pylint: disable=inconsistent-return-statements ) -> None: """Sets the time a blob will expire and be deleted. - :param comp: comp. "expiry" Required. - :type comp: str or ~azure.storage.blob.models.Enum22 :param expiry_options: Required. Indicates mode of the expiry time. Known values are: "NeverExpire", "RelativeToCreation", "RelativeToNow", and "Absolute". Required. :type expiry_options: str or ~azure.storage.blob.models.BlobExpiryOptions @@ -2241,6 +2226,9 @@ def set_expiry( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param expires_on: The time to set the blob to expiry. Default value is None. :type expires_on: str + :keyword comp: comp. Default value is "expiry". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -2255,18 +2243,19 @@ def set_expiry( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["expiry"] = kwargs.pop("comp", _params.pop("comp", "expiry")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_set_expiry_request( url=self._config.url, - comp=comp, expiry_options=expiry_options, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, expires_on=expires_on, + comp=comp, + version=self._config.version, template_url=self.set_expiry.metadata["url"], headers=_headers, params=_params, @@ -2303,7 +2292,6 @@ def set_expiry( # pylint: disable=inconsistent-return-statements @distributed_trace def set_http_headers( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum1], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, @@ -2313,8 +2301,6 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements ) -> None: """The Set HTTP Headers operation sets system properties on the blob. - :param comp: comp. "properties" Required. - :type comp: str or ~azure.storage.blob.models.Enum1 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -2330,6 +2316,9 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -2344,8 +2333,9 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) cls: ClsType[None] = kwargs.pop("cls", None) _blob_cache_control = None @@ -2378,8 +2368,6 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements request = build_set_http_headers_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, blob_cache_control=_blob_cache_control, blob_content_type=_blob_content_type, @@ -2394,6 +2382,8 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements if_tags=_if_tags, blob_content_disposition=_blob_content_disposition, request_id_parameter=request_id_parameter, + comp=comp, + version=self._config.version, template_url=self.set_http_headers.metadata["url"], headers=_headers, params=_params, @@ -2433,7 +2423,6 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements @distributed_trace def set_immutability_policy( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum24], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, @@ -2443,8 +2432,6 @@ def set_immutability_policy( # pylint: disable=inconsistent-return-statements ) -> None: """The Set Immutability Policy operation sets the immutability policy on the blob. - :param comp: comp. "immutabilityPolicies" Required. - :type comp: str or ~azure.storage.blob.models.Enum24 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -2462,6 +2449,9 @@ def set_immutability_policy( # pylint: disable=inconsistent-return-statements :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "immutabilityPolicies". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -2476,8 +2466,9 @@ def set_immutability_policy( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["immutabilityPolicies"] = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) cls: ClsType[None] = kwargs.pop("cls", None) _if_unmodified_since = None @@ -2486,13 +2477,13 @@ def set_immutability_policy( # pylint: disable=inconsistent-return-statements request = build_set_immutability_policy_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, if_unmodified_since=_if_unmodified_since, immutability_policy_expiry=immutability_policy_expiry, immutability_policy_mode=immutability_policy_mode, + comp=comp, + version=self._config.version, template_url=self.set_immutability_policy.metadata["url"], headers=_headers, params=_params, @@ -2532,16 +2523,10 @@ def set_immutability_policy( # pylint: disable=inconsistent-return-statements @distributed_trace def delete_immutability_policy( # pylint: disable=inconsistent-return-statements - self, - comp: Union[str, _models.Enum24], - timeout: Optional[int] = None, - request_id_parameter: Optional[str] = None, - **kwargs: Any + self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: """The Delete Immutability Policy operation deletes the immutability policy on the blob. - :param comp: comp. "immutabilityPolicies" Required. - :type comp: str or ~azure.storage.blob.models.Enum24 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -2551,6 +2536,9 @@ def delete_immutability_policy( # pylint: disable=inconsistent-return-statement limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword comp: comp. Default value is "immutabilityPolicies". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -2565,16 +2553,17 @@ def delete_immutability_policy( # pylint: disable=inconsistent-return-statement error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["immutabilityPolicies"] = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_immutability_policy_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, + comp=comp, + version=self._config.version, template_url=self.delete_immutability_policy.metadata["url"], headers=_headers, params=_params, @@ -2608,17 +2597,10 @@ def delete_immutability_policy( # pylint: disable=inconsistent-return-statement @distributed_trace def set_legal_hold( # pylint: disable=inconsistent-return-statements - self, - comp: Union[str, _models.Enum25], - legal_hold: bool, - timeout: Optional[int] = None, - request_id_parameter: Optional[str] = None, - **kwargs: Any + self, legal_hold: bool, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> None: """The Set Legal Hold operation sets a legal hold on the blob. - :param comp: comp. "legalhold" Required. - :type comp: str or ~azure.storage.blob.models.Enum25 :param legal_hold: Specified if a legal hold should be set on the blob. Required. :type legal_hold: bool :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -2630,6 +2612,9 @@ def set_legal_hold( # pylint: disable=inconsistent-return-statements limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword comp: comp. Default value is "legalhold". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -2644,17 +2629,18 @@ def set_legal_hold( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["legalhold"] = kwargs.pop("comp", _params.pop("comp", "legalhold")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_set_legal_hold_request( url=self._config.url, - comp=comp, legal_hold=legal_hold, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, + comp=comp, + version=self._config.version, template_url=self.set_legal_hold.metadata["url"], headers=_headers, params=_params, @@ -2690,7 +2676,6 @@ def set_legal_hold( # pylint: disable=inconsistent-return-statements @distributed_trace def set_metadata( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum12], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, request_id_parameter: Optional[str] = None, @@ -2703,8 +2688,6 @@ def set_metadata( # pylint: disable=inconsistent-return-statements """The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-value pairs. - :param comp: comp. "metadata" Required. - :type comp: str or ~azure.storage.blob.models.Enum12 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -2730,6 +2713,9 @@ def set_metadata( # pylint: disable=inconsistent-return-statements :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "metadata". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -2744,8 +2730,9 @@ def set_metadata( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None @@ -2775,8 +2762,6 @@ def set_metadata( # pylint: disable=inconsistent-return-statements request = build_set_metadata_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, metadata=metadata, lease_id=_lease_id, @@ -2790,6 +2775,8 @@ def set_metadata( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, + version=self._config.version, template_url=self.set_metadata.metadata["url"], headers=_headers, params=_params, @@ -2836,7 +2823,6 @@ def set_metadata( # pylint: disable=inconsistent-return-statements @distributed_trace def acquire_lease( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum16], timeout: Optional[int] = None, duration: Optional[int] = None, proposed_lease_id: Optional[str] = None, @@ -2847,8 +2833,6 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements """[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - :param comp: comp. "lease" Required. - :type comp: str or ~azure.storage.blob.models.Enum16 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -2868,6 +2852,9 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword action: Describes what lease action to take. Default value is "acquire". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -2885,8 +2872,9 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -2904,8 +2892,6 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements request = build_acquire_lease_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, duration=duration, proposed_lease_id=proposed_lease_id, @@ -2915,7 +2901,9 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, action=action, + version=self._config.version, template_url=self.acquire_lease.metadata["url"], headers=_headers, params=_params, @@ -2953,7 +2941,6 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements @distributed_trace def release_lease( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum16], lease_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -2963,8 +2950,6 @@ def release_lease( # pylint: disable=inconsistent-return-statements """[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - :param comp: comp. "lease" Required. - :type comp: str or ~azure.storage.blob.models.Enum16 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -2978,6 +2963,9 @@ def release_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword action: Describes what lease action to take. Default value is "release". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -2995,8 +2983,9 @@ def release_lease( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -3014,9 +3003,7 @@ def release_lease( # pylint: disable=inconsistent-return-statements request = build_release_lease_request( url=self._config.url, - comp=comp, lease_id=lease_id, - version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, @@ -3024,7 +3011,9 @@ def release_lease( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, action=action, + version=self._config.version, template_url=self.release_lease.metadata["url"], headers=_headers, params=_params, @@ -3061,7 +3050,6 @@ def release_lease( # pylint: disable=inconsistent-return-statements @distributed_trace def renew_lease( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum16], lease_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -3071,8 +3059,6 @@ def renew_lease( # pylint: disable=inconsistent-return-statements """[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - :param comp: comp. "lease" Required. - :type comp: str or ~azure.storage.blob.models.Enum16 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -3086,6 +3072,9 @@ def renew_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword action: Describes what lease action to take. Default value is "renew". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -3103,8 +3092,9 @@ def renew_lease( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -3122,9 +3112,7 @@ def renew_lease( # pylint: disable=inconsistent-return-statements request = build_renew_lease_request( url=self._config.url, - comp=comp, lease_id=lease_id, - version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, @@ -3132,7 +3120,9 @@ def renew_lease( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, action=action, + version=self._config.version, template_url=self.renew_lease.metadata["url"], headers=_headers, params=_params, @@ -3170,7 +3160,6 @@ def renew_lease( # pylint: disable=inconsistent-return-statements @distributed_trace def change_lease( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum16], lease_id: str, proposed_lease_id: str, timeout: Optional[int] = None, @@ -3181,8 +3170,6 @@ def change_lease( # pylint: disable=inconsistent-return-statements """[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - :param comp: comp. "lease" Required. - :type comp: str or ~azure.storage.blob.models.Enum16 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param proposed_lease_id: Proposed lease ID, in a GUID string format. The Blob service returns @@ -3200,6 +3187,9 @@ def change_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword action: Describes what lease action to take. Default value is "change". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -3217,8 +3207,9 @@ def change_lease( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -3236,10 +3227,8 @@ def change_lease( # pylint: disable=inconsistent-return-statements request = build_change_lease_request( url=self._config.url, - comp=comp, lease_id=lease_id, proposed_lease_id=proposed_lease_id, - version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, @@ -3247,7 +3236,9 @@ def change_lease( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, action=action, + version=self._config.version, template_url=self.change_lease.metadata["url"], headers=_headers, params=_params, @@ -3285,7 +3276,6 @@ def change_lease( # pylint: disable=inconsistent-return-statements @distributed_trace def break_lease( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum16], timeout: Optional[int] = None, break_period: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -3295,8 +3285,6 @@ def break_lease( # pylint: disable=inconsistent-return-statements """[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - :param comp: comp. "lease" Required. - :type comp: str or ~azure.storage.blob.models.Enum16 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -3316,6 +3304,9 @@ def break_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword action: Describes what lease action to take. Default value is "break". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -3333,8 +3324,9 @@ def break_lease( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -3352,8 +3344,6 @@ def break_lease( # pylint: disable=inconsistent-return-statements request = build_break_lease_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, break_period=break_period, if_modified_since=_if_modified_since, @@ -3362,7 +3352,9 @@ def break_lease( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, action=action, + version=self._config.version, template_url=self.break_lease.metadata["url"], headers=_headers, params=_params, @@ -3400,7 +3392,6 @@ def break_lease( # pylint: disable=inconsistent-return-statements @distributed_trace def create_snapshot( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum26], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, request_id_parameter: Optional[str] = None, @@ -3412,8 +3403,6 @@ def create_snapshot( # pylint: disable=inconsistent-return-statements ) -> None: """The Create Snapshot operation creates a read-only snapshot of a blob. - :param comp: comp. "snapshot" Required. - :type comp: str or ~azure.storage.blob.models.Enum26 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -3439,6 +3428,9 @@ def create_snapshot( # pylint: disable=inconsistent-return-statements :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword comp: comp. Default value is "snapshot". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -3453,8 +3445,9 @@ def create_snapshot( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["snapshot"] = kwargs.pop("comp", _params.pop("comp", "snapshot")) cls: ClsType[None] = kwargs.pop("cls", None) _encryption_key = None @@ -3484,8 +3477,6 @@ def create_snapshot( # pylint: disable=inconsistent-return-statements request = build_create_snapshot_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, metadata=metadata, encryption_key=_encryption_key, @@ -3499,6 +3490,8 @@ def create_snapshot( # pylint: disable=inconsistent-return-statements if_tags=_if_tags, lease_id=_lease_id, request_id_parameter=request_id_parameter, + comp=comp, + version=self._config.version, template_url=self.create_snapshot.metadata["url"], headers=_headers, params=_params, @@ -3655,7 +3648,6 @@ def start_copy_from_url( # pylint: disable=inconsistent-return-statements request = build_start_copy_from_url_request( url=self._config.url, copy_source=copy_source, - version=self._config.version, timeout=timeout, metadata=metadata, tier=tier, @@ -3677,6 +3669,7 @@ def start_copy_from_url( # pylint: disable=inconsistent-return-statements immutability_policy_expiry=immutability_policy_expiry, immutability_policy_mode=immutability_policy_mode, legal_hold=legal_hold, + version=self._config.version, template_url=self.start_copy_from_url.metadata["url"], headers=_headers, params=_params, @@ -3716,7 +3709,6 @@ def start_copy_from_url( # pylint: disable=inconsistent-return-statements @distributed_trace def copy_from_url( # pylint: disable=inconsistent-return-statements self, - x_ms_requires_sync: Union[str, _models.Enum27], copy_source: str, timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, @@ -3738,9 +3730,6 @@ def copy_from_url( # pylint: disable=inconsistent-return-statements """The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response until the copy is complete. - :param x_ms_requires_sync: This header indicates that this is a synchronous Copy Blob From URL - instead of a Asynchronous Copy Blob. "true" Required. - :type x_ms_requires_sync: str or ~azure.storage.blob.models.Enum27 :param copy_source: Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated @@ -3797,6 +3786,10 @@ def copy_from_url( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo + :keyword x_ms_requires_sync: This header indicates that this is a synchronous Copy Blob From + URL instead of a Asynchronous Copy Blob. Default value is "true". Note that overriding this + default value may result in unsupported behavior. + :paramtype x_ms_requires_sync: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -3810,9 +3803,12 @@ def copy_from_url( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + x_ms_requires_sync: Literal["true"] = kwargs.pop( + "x_ms_requires_sync", _headers.pop("x-ms-requires-sync", "true") + ) cls: ClsType[None] = kwargs.pop("cls", None) _source_if_modified_since = None @@ -3844,9 +3840,7 @@ def copy_from_url( # pylint: disable=inconsistent-return-statements request = build_copy_from_url_request( url=self._config.url, - x_ms_requires_sync=x_ms_requires_sync, copy_source=copy_source, - version=self._config.version, timeout=timeout, metadata=metadata, tier=tier, @@ -3869,6 +3863,8 @@ def copy_from_url( # pylint: disable=inconsistent-return-statements copy_source_authorization=copy_source_authorization, encryption_scope=_encryption_scope, copy_source_tags=copy_source_tags, + x_ms_requires_sync=x_ms_requires_sync, + version=self._config.version, template_url=self.copy_from_url.metadata["url"], headers=_headers, params=_params, @@ -3915,8 +3911,6 @@ def copy_from_url( # pylint: disable=inconsistent-return-statements @distributed_trace def abort_copy_from_url( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum28], - copy_action_abort_constant: Union[str, _models.Enum29], copy_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -3926,10 +3920,6 @@ def abort_copy_from_url( # pylint: disable=inconsistent-return-statements """The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with zero length and full metadata. - :param comp: comp. "copy" Required. - :type comp: str or ~azure.storage.blob.models.Enum28 - :param copy_action_abort_constant: Copy action. "abort" Required. - :type copy_action_abort_constant: str or ~azure.storage.blob.models.Enum29 :param copy_id: The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. Required. :type copy_id: str @@ -3944,6 +3934,12 @@ def abort_copy_from_url( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword comp: comp. Default value is "copy". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword copy_action_abort_constant: Copy action. Default value is "abort". Note that + overriding this default value may result in unsupported behavior. + :paramtype copy_action_abort_constant: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -3957,9 +3953,13 @@ def abort_copy_from_url( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["copy"] = kwargs.pop("comp", _params.pop("comp", "copy")) + copy_action_abort_constant: Literal["abort"] = kwargs.pop( + "copy_action_abort_constant", _headers.pop("x-ms-copy-action", "abort") + ) cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None @@ -3968,13 +3968,13 @@ def abort_copy_from_url( # pylint: disable=inconsistent-return-statements request = build_abort_copy_from_url_request( url=self._config.url, - comp=comp, - copy_action_abort_constant=copy_action_abort_constant, copy_id=copy_id, - version=self._config.version, timeout=timeout, lease_id=_lease_id, request_id_parameter=request_id_parameter, + comp=comp, + copy_action_abort_constant=copy_action_abort_constant, + version=self._config.version, template_url=self.abort_copy_from_url.metadata["url"], headers=_headers, params=_params, @@ -4009,7 +4009,6 @@ def abort_copy_from_url( # pylint: disable=inconsistent-return-statements @distributed_trace def set_tier( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum30], tier: Union[str, _models.AccessTierRequired], snapshot: Optional[str] = None, version_id: Optional[str] = None, @@ -4026,8 +4025,6 @@ def set_tier( # pylint: disable=inconsistent-return-statements the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag. - :param comp: comp. "tier" Required. - :type comp: str or ~azure.storage.blob.models.Enum30 :param tier: Indicates the tier to be set on the blob. Known values are: "P4", "P6", "P10", "P15", "P20", "P30", "P40", "P50", "P60", "P70", "P80", "Hot", "Cool", "Archive", and "Cold". Required. @@ -4058,6 +4055,9 @@ def set_tier( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "tier". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -4072,8 +4072,9 @@ def set_tier( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["tier"] = kwargs.pop("comp", _params.pop("comp", "tier")) cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None @@ -4085,9 +4086,7 @@ def set_tier( # pylint: disable=inconsistent-return-statements request = build_set_tier_request( url=self._config.url, - comp=comp, tier=tier, - version=self._config.version, snapshot=snapshot, version_id=version_id, timeout=timeout, @@ -4095,6 +4094,8 @@ def set_tier( # pylint: disable=inconsistent-return-statements request_id_parameter=request_id_parameter, lease_id=_lease_id, if_tags=_if_tags, + comp=comp, + version=self._config.version, template_url=self.set_tier.metadata["url"], headers=_headers, params=_params, @@ -4134,15 +4135,15 @@ def set_tier( # pylint: disable=inconsistent-return-statements set_tier.metadata = {"url": "{url}/{containerName}/{blob}"} @distributed_trace - def get_account_info( # pylint: disable=inconsistent-return-statements - self, restype: Union[str, _models.Enum8], comp: Union[str, _models.Enum1], **kwargs: Any - ) -> None: + def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements """Returns the sku name and account kind. - :param restype: restype. "account" Required. - :type restype: str or ~azure.storage.blob.models.Enum8 - :param comp: comp. "properties" Required. - :type comp: str or ~azure.storage.blob.models.Enum1 + :keyword restype: restype. Default value is "account". Note that overriding this default value + may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -4157,8 +4158,10 @@ def get_account_info( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account")) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_get_account_info_request( @@ -4202,7 +4205,6 @@ def get_account_info( # pylint: disable=inconsistent-return-statements @distributed_trace def query( self, - comp: Union[str, _models.Enum39], snapshot: Optional[str] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -4215,8 +4217,6 @@ def query( """The Query operation enables users to select/project on blob data by providing simple query expressions. - :param comp: comp. "query" Required. - :type comp: str or ~azure.storage.blob.models.Enum39 :param snapshot: The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:` _models.BlobTags: """The Get Tags operation enables users to get the tags associated with a blob. - :param comp: comp. "tags" Required. - :type comp: str or ~azure.storage.blob.models.Enum41 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -4491,6 +4492,9 @@ def get_tags( :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword comp: comp. Default value is "tags". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: BlobTags or the result of cls(response) :rtype: ~azure.storage.blob.models.BlobTags @@ -4505,8 +4509,9 @@ def get_tags( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["tags"] = kwargs.pop("comp", _params.pop("comp", "tags")) cls: ClsType[_models.BlobTags] = kwargs.pop("cls", None) _if_tags = None @@ -4518,14 +4523,14 @@ def get_tags( request = build_get_tags_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, snapshot=snapshot, version_id=version_id, if_tags=_if_tags, lease_id=_lease_id, + comp=comp, + version=self._config.version, template_url=self.get_tags.metadata["url"], headers=_headers, params=_params, @@ -4564,7 +4569,6 @@ def get_tags( @distributed_trace def set_tags( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum41], timeout: Optional[int] = None, version_id: Optional[str] = None, transactional_content_md5: Optional[bytes] = None, @@ -4577,8 +4581,6 @@ def set_tags( # pylint: disable=inconsistent-return-statements ) -> None: """The Set Tags operation enables users to set tags on a blob. - :param comp: comp. "tags" Required. - :type comp: str or ~azure.storage.blob.models.Enum41 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -4604,6 +4606,9 @@ def set_tags( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param tags: Blob tags. Default value is None. :type tags: ~azure.storage.blob.models.BlobTags + :keyword comp: comp. Default value is "tags". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -4618,8 +4623,9 @@ def set_tags( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["tags"] = kwargs.pop("comp", _params.pop("comp", "tags")) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -4636,8 +4642,6 @@ def set_tags( # pylint: disable=inconsistent-return-statements request = build_set_tags_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, version_id=version_id, transactional_content_md5=transactional_content_md5, @@ -4645,7 +4649,9 @@ def set_tags( # pylint: disable=inconsistent-return-statements request_id_parameter=request_id_parameter, if_tags=_if_tags, lease_id=_lease_id, + comp=comp, content_type=content_type, + version=self._config.version, content=_content, template_url=self.set_tags.metadata["url"], headers=_headers, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py index 820f4d9731ca..d462aa84f7cb 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py @@ -44,7 +44,6 @@ def build_upload_request( *, content_length: int, content: IO, - version: Union[str, _models.Enum2], timeout: Optional[int] = None, transactional_content_md5: Optional[bytes] = None, blob_content_type: Optional[str] = None, @@ -78,6 +77,7 @@ def build_upload_request( blob_type: Literal["BlockBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -174,7 +174,6 @@ def build_put_blob_from_url_request( *, content_length: int, copy_source: str, - version: Union[str, _models.Enum2], timeout: Optional[int] = None, transactional_content_md5: Optional[bytes] = None, blob_content_type: Optional[str] = None, @@ -212,6 +211,7 @@ def build_put_blob_from_url_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) blob_type: Literal["BlockBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -317,11 +317,9 @@ def build_put_blob_from_url_request( def build_stage_block_request( url: str, *, - comp: Union[str, _models.Enum32], block_id: str, content_length: int, content: IO, - version: Union[str, _models.Enum2], transactional_content_md5: Optional[bytes] = None, transactional_content_crc64: Optional[bytes] = None, timeout: Optional[int] = None, @@ -336,7 +334,9 @@ def build_stage_block_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["block"] = kwargs.pop("comp", _params.pop("comp", "block")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -388,11 +388,9 @@ def build_stage_block_request( def build_stage_block_from_url_request( url: str, *, - comp: Union[str, _models.Enum32], block_id: str, content_length: int, source_url: str, - version: Union[str, _models.Enum2], source_range: Optional[str] = None, source_content_md5: Optional[bytes] = None, source_contentcrc64: Optional[bytes] = None, @@ -413,6 +411,8 @@ def build_stage_block_from_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["block"] = kwargs.pop("comp", _params.pop("comp", "block")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -479,9 +479,7 @@ def build_stage_block_from_url_request( def build_commit_block_list_request( url: str, *, - comp: Union[str, _models.Enum33], content: Any, - version: Union[str, _models.Enum2], timeout: Optional[int] = None, blob_cache_control: Optional[str] = None, blob_content_type: Optional[str] = None, @@ -513,7 +511,9 @@ def build_commit_block_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["blocklist"] = kwargs.pop("comp", _params.pop("comp", "blocklist")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -607,8 +607,6 @@ def build_commit_block_list_request( def build_get_block_list_request( url: str, *, - comp: Union[str, _models.Enum33], - version: Union[str, _models.Enum2], snapshot: Optional[str] = None, list_type: Union[str, _models.BlockListType] = "committed", timeout: Optional[int] = None, @@ -620,6 +618,8 @@ def build_get_block_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["blocklist"] = kwargs.pop("comp", _params.pop("comp", "blocklist")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -816,7 +816,6 @@ def upload( # pylint: disable=inconsistent-return-statements request = build_upload_request( url=self._config.url, content_length=content_length, - version=self._config.version, timeout=timeout, transactional_content_md5=transactional_content_md5, blob_content_type=_blob_content_type, @@ -845,6 +844,7 @@ def upload( # pylint: disable=inconsistent-return-statements transactional_content_crc64=transactional_content_crc64, blob_type=blob_type, content_type=content_type, + version=self._config.version, content=_content, template_url=self.upload.metadata["url"], headers=_headers, @@ -1055,7 +1055,6 @@ def put_blob_from_url( # pylint: disable=inconsistent-return-statements url=self._config.url, content_length=content_length, copy_source=copy_source, - version=self._config.version, timeout=timeout, transactional_content_md5=transactional_content_md5, blob_content_type=_blob_content_type, @@ -1088,6 +1087,7 @@ def put_blob_from_url( # pylint: disable=inconsistent-return-statements copy_source_authorization=copy_source_authorization, copy_source_tags=copy_source_tags, blob_type=blob_type, + version=self._config.version, template_url=self.put_blob_from_url.metadata["url"], headers=_headers, params=_params, @@ -1135,7 +1135,6 @@ def put_blob_from_url( # pylint: disable=inconsistent-return-statements @distributed_trace def stage_block( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum32], block_id: str, content_length: int, body: IO, @@ -1150,8 +1149,6 @@ def stage_block( # pylint: disable=inconsistent-return-statements ) -> None: """The Stage Block operation creates a new block to be committed as part of a blob. - :param comp: comp. "block" Required. - :type comp: str or ~azure.storage.blob.models.Enum32 :param block_id: A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the same size for each block. Required. @@ -1181,6 +1178,9 @@ def stage_block( # pylint: disable=inconsistent-return-statements :type cpk_info: ~azure.storage.blob.models.CpkInfo :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo + :keyword comp: comp. Default value is "block". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -1195,8 +1195,9 @@ def stage_block( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["block"] = kwargs.pop("comp", _params.pop("comp", "block")) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1217,10 +1218,8 @@ def stage_block( # pylint: disable=inconsistent-return-statements request = build_stage_block_request( url=self._config.url, - comp=comp, block_id=block_id, content_length=content_length, - version=self._config.version, transactional_content_md5=transactional_content_md5, transactional_content_crc64=transactional_content_crc64, timeout=timeout, @@ -1230,7 +1229,9 @@ def stage_block( # pylint: disable=inconsistent-return-statements encryption_algorithm=_encryption_algorithm, encryption_scope=_encryption_scope, request_id_parameter=request_id_parameter, + comp=comp, content_type=content_type, + version=self._config.version, content=_content, template_url=self.stage_block.metadata["url"], headers=_headers, @@ -1279,7 +1280,6 @@ def stage_block( # pylint: disable=inconsistent-return-statements @distributed_trace def stage_block_from_url( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum32], block_id: str, content_length: int, source_url: str, @@ -1298,8 +1298,6 @@ def stage_block_from_url( # pylint: disable=inconsistent-return-statements """The Stage Block operation creates a new block to be committed as part of a blob where the contents are read from a URL. - :param comp: comp. "block" Required. - :type comp: str or ~azure.storage.blob.models.Enum32 :param block_id: A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the same size for each block. Required. @@ -1337,6 +1335,9 @@ def stage_block_from_url( # pylint: disable=inconsistent-return-statements :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions + :keyword comp: comp. Default value is "block". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -1351,8 +1352,9 @@ def stage_block_from_url( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["block"] = kwargs.pop("comp", _params.pop("comp", "block")) cls: ClsType[None] = kwargs.pop("cls", None) _encryption_key = None @@ -1380,11 +1382,9 @@ def stage_block_from_url( # pylint: disable=inconsistent-return-statements request = build_stage_block_from_url_request( url=self._config.url, - comp=comp, block_id=block_id, content_length=content_length, source_url=source_url, - version=self._config.version, source_range=source_range, source_content_md5=source_content_md5, source_contentcrc64=source_contentcrc64, @@ -1400,6 +1400,8 @@ def stage_block_from_url( # pylint: disable=inconsistent-return-statements source_if_none_match=_source_if_none_match, request_id_parameter=request_id_parameter, copy_source_authorization=copy_source_authorization, + comp=comp, + version=self._config.version, template_url=self.stage_block_from_url.metadata["url"], headers=_headers, params=_params, @@ -1447,7 +1449,6 @@ def stage_block_from_url( # pylint: disable=inconsistent-return-statements @distributed_trace def commit_block_list( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum33], blocks: _models.BlockLookupList, timeout: Optional[int] = None, transactional_content_md5: Optional[bytes] = None, @@ -1474,8 +1475,6 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements or from the uncommitted block list, or to commit the most recently uploaded version of the block, whichever list it may belong to. - :param comp: comp. "blocklist" Required. - :type comp: str or ~azure.storage.blob.models.Enum33 :param blocks: Blob Blocks. Required. :type blocks: ~azure.storage.blob.models.BlockLookupList :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -1526,6 +1525,9 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "blocklist". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -1540,8 +1542,9 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["blocklist"] = kwargs.pop("comp", _params.pop("comp", "blocklist")) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1586,8 +1589,6 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements request = build_commit_block_list_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, blob_cache_control=_blob_cache_control, blob_content_type=_blob_content_type, @@ -1614,7 +1615,9 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements immutability_policy_expiry=immutability_policy_expiry, immutability_policy_mode=immutability_policy_mode, legal_hold=legal_hold, + comp=comp, content_type=content_type, + version=self._config.version, content=_content, template_url=self.commit_block_list.metadata["url"], headers=_headers, @@ -1666,7 +1669,6 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements @distributed_trace def get_block_list( self, - comp: Union[str, _models.Enum33], snapshot: Optional[str] = None, list_type: Union[str, _models.BlockListType] = "committed", timeout: Optional[int] = None, @@ -1678,8 +1680,6 @@ def get_block_list( """The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob. - :param comp: comp. "blocklist" Required. - :type comp: str or ~azure.storage.blob.models.Enum33 :param snapshot: The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:` HttpRequest: +def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account")) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -905,7 +901,6 @@ def __init__(self, *args, **kwargs): @distributed_trace def create( # pylint: disable=inconsistent-return-statements self, - restype: Union[str, _models.Enum11], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, access: Optional[Union[str, _models.PublicAccessType]] = None, @@ -916,8 +911,6 @@ def create( # pylint: disable=inconsistent-return-statements """creates a new container under the specified account. If the container with the same name already exists, the operation fails. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -940,6 +933,9 @@ def create( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param container_cpk_scope_info: Parameter group. Default value is None. :type container_cpk_scope_info: ~azure.storage.blob.models.ContainerCpkScopeInfo + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -954,8 +950,9 @@ def create( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) cls: ClsType[None] = kwargs.pop("cls", None) _default_encryption_scope = None @@ -966,14 +963,14 @@ def create( # pylint: disable=inconsistent-return-statements request = build_create_request( url=self._config.url, - restype=restype, - version=self._config.version, timeout=timeout, metadata=metadata, access=access, request_id_parameter=request_id_parameter, default_encryption_scope=_default_encryption_scope, prevent_encryption_scope_override=_prevent_encryption_scope_override, + restype=restype, + version=self._config.version, template_url=self.create.metadata["url"], headers=_headers, params=_params, @@ -1010,7 +1007,6 @@ def create( # pylint: disable=inconsistent-return-statements @distributed_trace def get_properties( # pylint: disable=inconsistent-return-statements self, - restype: Union[str, _models.Enum11], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -1019,8 +1015,6 @@ def get_properties( # pylint: disable=inconsistent-return-statements """returns all user-defined metadata and system properties for the specified container. The data returned does not include the container's list of blobs. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1032,6 +1026,9 @@ def get_properties( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -1046,8 +1043,9 @@ def get_properties( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None @@ -1056,11 +1054,11 @@ def get_properties( # pylint: disable=inconsistent-return-statements request = build_get_properties_request( url=self._config.url, - restype=restype, - version=self._config.version, timeout=timeout, lease_id=_lease_id, request_id_parameter=request_id_parameter, + restype=restype, + version=self._config.version, template_url=self.get_properties.metadata["url"], headers=_headers, params=_params, @@ -1117,7 +1115,6 @@ def get_properties( # pylint: disable=inconsistent-return-statements @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, - restype: Union[str, _models.Enum11], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -1127,8 +1124,6 @@ def delete( # pylint: disable=inconsistent-return-statements """operation marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1142,6 +1137,9 @@ def delete( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -1156,8 +1154,9 @@ def delete( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None @@ -1171,13 +1170,13 @@ def delete( # pylint: disable=inconsistent-return-statements request = build_delete_request( url=self._config.url, - restype=restype, - version=self._config.version, timeout=timeout, lease_id=_lease_id, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, + restype=restype, + version=self._config.version, template_url=self.delete.metadata["url"], headers=_headers, params=_params, @@ -1212,8 +1211,6 @@ def delete( # pylint: disable=inconsistent-return-statements @distributed_trace def set_metadata( # pylint: disable=inconsistent-return-statements self, - restype: Union[str, _models.Enum11], - comp: Union[str, _models.Enum12], timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, request_id_parameter: Optional[str] = None, @@ -1223,10 +1220,6 @@ def set_metadata( # pylint: disable=inconsistent-return-statements ) -> None: """operation sets one or more user-defined name-value pairs for the specified container. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 - :param comp: comp. "metadata" Required. - :type comp: str or ~azure.storage.blob.models.Enum12 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1248,6 +1241,12 @@ def set_metadata( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "metadata". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -1262,8 +1261,10 @@ def set_metadata( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) + comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None @@ -1275,14 +1276,14 @@ def set_metadata( # pylint: disable=inconsistent-return-statements request = build_set_metadata_request( url=self._config.url, - restype=restype, - comp=comp, - version=self._config.version, timeout=timeout, lease_id=_lease_id, metadata=metadata, if_modified_since=_if_modified_since, request_id_parameter=request_id_parameter, + restype=restype, + comp=comp, + version=self._config.version, template_url=self.set_metadata.metadata["url"], headers=_headers, params=_params, @@ -1319,8 +1320,6 @@ def set_metadata( # pylint: disable=inconsistent-return-statements @distributed_trace def get_access_policy( self, - restype: Union[str, _models.Enum11], - comp: Union[str, _models.Enum13], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -1329,10 +1328,6 @@ def get_access_policy( """gets the permissions for the specified container. The permissions indicate whether container data may be accessed publicly. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 - :param comp: comp. "acl" Required. - :type comp: str or ~azure.storage.blob.models.Enum13 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1344,6 +1339,12 @@ def get_access_policy( :type request_id_parameter: str :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "acl". Note that overriding this default value may result + in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of SignedIdentifier or the result of cls(response) :rtype: list[~azure.storage.blob.models.SignedIdentifier] @@ -1358,8 +1359,10 @@ def get_access_policy( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) + comp: Literal["acl"] = kwargs.pop("comp", _params.pop("comp", "acl")) cls: ClsType[List[_models.SignedIdentifier]] = kwargs.pop("cls", None) _lease_id = None @@ -1368,12 +1371,12 @@ def get_access_policy( request = build_get_access_policy_request( url=self._config.url, - restype=restype, - comp=comp, - version=self._config.version, timeout=timeout, lease_id=_lease_id, request_id_parameter=request_id_parameter, + restype=restype, + comp=comp, + version=self._config.version, template_url=self.get_access_policy.metadata["url"], headers=_headers, params=_params, @@ -1417,8 +1420,6 @@ def get_access_policy( @distributed_trace def set_access_policy( # pylint: disable=inconsistent-return-statements self, - restype: Union[str, _models.Enum11], - comp: Union[str, _models.Enum13], timeout: Optional[int] = None, access: Optional[Union[str, _models.PublicAccessType]] = None, request_id_parameter: Optional[str] = None, @@ -1430,10 +1431,6 @@ def set_access_policy( # pylint: disable=inconsistent-return-statements """sets the permissions for the specified container. The permissions indicate whether blobs in a container may be accessed publicly. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 - :param comp: comp. "acl" Required. - :type comp: str or ~azure.storage.blob.models.Enum13 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1452,6 +1449,12 @@ def set_access_policy( # pylint: disable=inconsistent-return-statements :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param container_acl: the acls for the container. Default value is None. :type container_acl: list[~azure.storage.blob.models.SignedIdentifier] + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "acl". Note that overriding this default value may result + in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -1466,8 +1469,10 @@ def set_access_policy( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) + comp: Literal["acl"] = kwargs.pop("comp", _params.pop("comp", "acl")) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1489,16 +1494,16 @@ def set_access_policy( # pylint: disable=inconsistent-return-statements request = build_set_access_policy_request( url=self._config.url, - restype=restype, - comp=comp, - version=self._config.version, timeout=timeout, lease_id=_lease_id, access=access, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, + restype=restype, + comp=comp, content_type=content_type, + version=self._config.version, content=_content, template_url=self.set_access_policy.metadata["url"], headers=_headers, @@ -1536,8 +1541,6 @@ def set_access_policy( # pylint: disable=inconsistent-return-statements @distributed_trace def restore( # pylint: disable=inconsistent-return-statements self, - restype: Union[str, _models.Enum11], - comp: Union[str, _models.Enum14], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, deleted_container_name: Optional[str] = None, @@ -1546,10 +1549,6 @@ def restore( # pylint: disable=inconsistent-return-statements ) -> None: """Restores a previously-deleted container. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 - :param comp: comp. "undelete" Required. - :type comp: str or ~azure.storage.blob.models.Enum14 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1565,6 +1564,12 @@ def restore( # pylint: disable=inconsistent-return-statements :param deleted_container_version: Optional. Version 2019-12-12 and later. Specifies the version of the deleted container to restore. Default value is None. :type deleted_container_version: str + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "undelete". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -1579,19 +1584,21 @@ def restore( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) + comp: Literal["undelete"] = kwargs.pop("comp", _params.pop("comp", "undelete")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_restore_request( url=self._config.url, - restype=restype, - comp=comp, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, deleted_container_name=deleted_container_name, deleted_container_version=deleted_container_version, + restype=restype, + comp=comp, + version=self._config.version, template_url=self.restore.metadata["url"], headers=_headers, params=_params, @@ -1626,8 +1633,6 @@ def restore( # pylint: disable=inconsistent-return-statements @distributed_trace def rename( # pylint: disable=inconsistent-return-statements self, - restype: Union[str, _models.Enum11], - comp: Union[str, _models.Enum15], source_container_name: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -1636,10 +1641,6 @@ def rename( # pylint: disable=inconsistent-return-statements ) -> None: """Renames an existing container. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 - :param comp: comp. "rename" Required. - :type comp: str or ~azure.storage.blob.models.Enum15 :param source_container_name: Required. Specifies the name of the container to rename. Required. :type source_container_name: str @@ -1655,6 +1656,12 @@ def rename( # pylint: disable=inconsistent-return-statements :param source_lease_id: A lease ID for the source path. If specified, the source path must have an active lease and the lease ID must match. Default value is None. :type source_lease_id: str + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "rename". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -1669,19 +1676,21 @@ def rename( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) + comp: Literal["rename"] = kwargs.pop("comp", _params.pop("comp", "rename")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_rename_request( url=self._config.url, - restype=restype, - comp=comp, source_container_name=source_container_name, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, source_lease_id=source_lease_id, + restype=restype, + comp=comp, + version=self._config.version, template_url=self.rename.metadata["url"], headers=_headers, params=_params, @@ -1716,8 +1725,6 @@ def rename( # pylint: disable=inconsistent-return-statements @distributed_trace def submit_batch( self, - restype: Union[str, _models.Enum11], - comp: Union[str, _models.Enum9], content_length: int, body: IO, timeout: Optional[int] = None, @@ -1726,10 +1733,6 @@ def submit_batch( ) -> Iterator[bytes]: """The Batch operation allows multiple API calls to be embedded into a single HTTP request. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 - :param comp: comp. "batch" Required. - :type comp: str or ~azure.storage.blob.models.Enum9 :param content_length: The length of the request. Required. :type content_length: int :param body: Initial data. Required. @@ -1743,6 +1746,12 @@ def submit_batch( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "batch". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Iterator of the response bytes or the result of cls(response) :rtype: Iterator[bytes] @@ -1757,8 +1766,10 @@ def submit_batch( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) + comp: Literal["batch"] = kwargs.pop("comp", _params.pop("comp", "batch")) multipart_content_type: str = kwargs.pop( "multipart_content_type", _headers.pop("Content-Type", "application/xml") ) @@ -1768,13 +1779,13 @@ def submit_batch( request = build_submit_batch_request( url=self._config.url, - restype=restype, - comp=comp, content_length=content_length, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, + restype=restype, + comp=comp, multipart_content_type=multipart_content_type, + version=self._config.version, content=_content, template_url=self.submit_batch.metadata["url"], headers=_headers, @@ -1811,8 +1822,6 @@ def submit_batch( @distributed_trace def filter_blobs( self, - restype: Union[str, _models.Enum11], - comp: Union[str, _models.Enum10], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, where: Optional[str] = None, @@ -1824,10 +1833,6 @@ def filter_blobs( """The Filter Blobs operation enables callers to list blobs in a container whose tags match a given search expression. Filter blobs searches within the given container. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 - :param comp: comp. "blobs" Required. - :type comp: str or ~azure.storage.blob.models.Enum10 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1857,6 +1862,12 @@ def filter_blobs( :param include: Include this parameter to specify one or more datasets to include in the response. Default value is None. :type include: list[str or ~azure.storage.blob.models.FilterBlobsIncludeItem] + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "blobs". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FilterBlobSegment or the result of cls(response) :rtype: ~azure.storage.blob.models.FilterBlobSegment @@ -1871,21 +1882,23 @@ def filter_blobs( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) + comp: Literal["blobs"] = kwargs.pop("comp", _params.pop("comp", "blobs")) cls: ClsType[_models.FilterBlobSegment] = kwargs.pop("cls", None) request = build_filter_blobs_request( url=self._config.url, - restype=restype, - comp=comp, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, where=where, marker=marker, maxresults=maxresults, include=include, + restype=restype, + comp=comp, + version=self._config.version, template_url=self.filter_blobs.metadata["url"], headers=_headers, params=_params, @@ -1924,8 +1937,6 @@ def filter_blobs( @distributed_trace def acquire_lease( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum16], - restype: Union[str, _models.Enum11], timeout: Optional[int] = None, duration: Optional[int] = None, proposed_lease_id: Optional[str] = None, @@ -1936,10 +1947,6 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements """[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. - :param comp: comp. "lease" Required. - :type comp: str or ~azure.storage.blob.models.Enum16 - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1959,6 +1966,12 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword action: Describes what lease action to take. Default value is "acquire". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -1976,8 +1989,10 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1989,16 +2004,16 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements request = build_acquire_lease_request( url=self._config.url, - comp=comp, - restype=restype, - version=self._config.version, timeout=timeout, duration=duration, proposed_lease_id=proposed_lease_id, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, + comp=comp, + restype=restype, action=action, + version=self._config.version, template_url=self.acquire_lease.metadata["url"], headers=_headers, params=_params, @@ -2036,8 +2051,6 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements @distributed_trace def release_lease( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum16], - restype: Union[str, _models.Enum11], lease_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -2047,10 +2060,6 @@ def release_lease( # pylint: disable=inconsistent-return-statements """[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. - :param comp: comp. "lease" Required. - :type comp: str or ~azure.storage.blob.models.Enum16 - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -2064,6 +2073,12 @@ def release_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword action: Describes what lease action to take. Default value is "release". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -2081,8 +2096,10 @@ def release_lease( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -2094,15 +2111,15 @@ def release_lease( # pylint: disable=inconsistent-return-statements request = build_release_lease_request( url=self._config.url, - comp=comp, - restype=restype, lease_id=lease_id, - version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, + comp=comp, + restype=restype, action=action, + version=self._config.version, template_url=self.release_lease.metadata["url"], headers=_headers, params=_params, @@ -2139,8 +2156,6 @@ def release_lease( # pylint: disable=inconsistent-return-statements @distributed_trace def renew_lease( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum16], - restype: Union[str, _models.Enum11], lease_id: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -2150,10 +2165,6 @@ def renew_lease( # pylint: disable=inconsistent-return-statements """[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. - :param comp: comp. "lease" Required. - :type comp: str or ~azure.storage.blob.models.Enum16 - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -2167,6 +2178,12 @@ def renew_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword action: Describes what lease action to take. Default value is "renew". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -2184,8 +2201,10 @@ def renew_lease( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -2197,15 +2216,15 @@ def renew_lease( # pylint: disable=inconsistent-return-statements request = build_renew_lease_request( url=self._config.url, - comp=comp, - restype=restype, lease_id=lease_id, - version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, + comp=comp, + restype=restype, action=action, + version=self._config.version, template_url=self.renew_lease.metadata["url"], headers=_headers, params=_params, @@ -2243,8 +2262,6 @@ def renew_lease( # pylint: disable=inconsistent-return-statements @distributed_trace def break_lease( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum16], - restype: Union[str, _models.Enum11], timeout: Optional[int] = None, break_period: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -2254,10 +2271,6 @@ def break_lease( # pylint: disable=inconsistent-return-statements """[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. - :param comp: comp. "lease" Required. - :type comp: str or ~azure.storage.blob.models.Enum16 - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -2277,6 +2290,12 @@ def break_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword action: Describes what lease action to take. Default value is "break". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -2294,8 +2313,10 @@ def break_lease( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -2307,15 +2328,15 @@ def break_lease( # pylint: disable=inconsistent-return-statements request = build_break_lease_request( url=self._config.url, - comp=comp, - restype=restype, - version=self._config.version, timeout=timeout, break_period=break_period, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, + comp=comp, + restype=restype, action=action, + version=self._config.version, template_url=self.break_lease.metadata["url"], headers=_headers, params=_params, @@ -2353,8 +2374,6 @@ def break_lease( # pylint: disable=inconsistent-return-statements @distributed_trace def change_lease( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum16], - restype: Union[str, _models.Enum11], lease_id: str, proposed_lease_id: str, timeout: Optional[int] = None, @@ -2365,10 +2384,6 @@ def change_lease( # pylint: disable=inconsistent-return-statements """[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. - :param comp: comp. "lease" Required. - :type comp: str or ~azure.storage.blob.models.Enum16 - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 :param lease_id: Specifies the current lease ID on the resource. Required. :type lease_id: str :param proposed_lease_id: Proposed lease ID, in a GUID string format. The Blob service returns @@ -2386,6 +2401,12 @@ def change_lease( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword action: Describes what lease action to take. Default value is "change". Note that overriding this default value may result in unsupported behavior. :paramtype action: str @@ -2403,8 +2424,10 @@ def change_lease( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -2416,16 +2439,16 @@ def change_lease( # pylint: disable=inconsistent-return-statements request = build_change_lease_request( url=self._config.url, - comp=comp, - restype=restype, lease_id=lease_id, proposed_lease_id=proposed_lease_id, - version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, request_id_parameter=request_id_parameter, + comp=comp, + restype=restype, action=action, + version=self._config.version, template_url=self.change_lease.metadata["url"], headers=_headers, params=_params, @@ -2463,8 +2486,6 @@ def change_lease( # pylint: disable=inconsistent-return-statements @distributed_trace def list_blob_flat_segment( self, - restype: Union[str, _models.Enum11], - comp: Union[str, _models.Enum5], prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, @@ -2475,10 +2496,6 @@ def list_blob_flat_segment( ) -> _models.ListBlobsFlatSegmentResponse: """[Update] The List Blobs operation returns a list of the blobs under the specified container. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 - :param comp: comp. "list" Required. - :type comp: str or ~azure.storage.blob.models.Enum5 :param prefix: Filters the results to return only containers whose name begins with the specified prefix. Default value is None. :type prefix: str @@ -2508,6 +2525,12 @@ def list_blob_flat_segment( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "list". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListBlobsFlatSegmentResponse or the result of cls(response) :rtype: ~azure.storage.blob.models.ListBlobsFlatSegmentResponse @@ -2522,21 +2545,23 @@ def list_blob_flat_segment( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) + comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) cls: ClsType[_models.ListBlobsFlatSegmentResponse] = kwargs.pop("cls", None) request = build_list_blob_flat_segment_request( url=self._config.url, - restype=restype, - comp=comp, - version=self._config.version, prefix=prefix, marker=marker, maxresults=maxresults, include=include, timeout=timeout, request_id_parameter=request_id_parameter, + restype=restype, + comp=comp, + version=self._config.version, template_url=self.list_blob_flat_segment.metadata["url"], headers=_headers, params=_params, @@ -2576,8 +2601,6 @@ def list_blob_flat_segment( @distributed_trace def list_blob_hierarchy_segment( self, - restype: Union[str, _models.Enum11], - comp: Union[str, _models.Enum5], delimiter: str, prefix: Optional[str] = None, marker: Optional[str] = None, @@ -2589,10 +2612,6 @@ def list_blob_hierarchy_segment( ) -> _models.ListBlobsHierarchySegmentResponse: """[Update] The List Blobs operation returns a list of the blobs under the specified container. - :param restype: restype. "container" Required. - :type restype: str or ~azure.storage.blob.models.Enum11 - :param comp: comp. "list" Required. - :type comp: str or ~azure.storage.blob.models.Enum5 :param delimiter: When the request includes this parameter, the operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may be a @@ -2627,6 +2646,12 @@ def list_blob_hierarchy_segment( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword restype: restype. Default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "list". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListBlobsHierarchySegmentResponse or the result of cls(response) :rtype: ~azure.storage.blob.models.ListBlobsHierarchySegmentResponse @@ -2641,22 +2666,24 @@ def list_blob_hierarchy_segment( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) + comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) cls: ClsType[_models.ListBlobsHierarchySegmentResponse] = kwargs.pop("cls", None) request = build_list_blob_hierarchy_segment_request( url=self._config.url, - restype=restype, - comp=comp, delimiter=delimiter, - version=self._config.version, prefix=prefix, marker=marker, maxresults=maxresults, include=include, timeout=timeout, request_id_parameter=request_id_parameter, + restype=restype, + comp=comp, + version=self._config.version, template_url=self.list_blob_hierarchy_segment.metadata["url"], headers=_headers, params=_params, @@ -2694,15 +2721,15 @@ def list_blob_hierarchy_segment( list_blob_hierarchy_segment.metadata = {"url": "{url}/{containerName}"} @distributed_trace - def get_account_info( # pylint: disable=inconsistent-return-statements - self, restype: Union[str, _models.Enum8], comp: Union[str, _models.Enum1], **kwargs: Any - ) -> None: + def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements """Returns the sku name and account kind. - :param restype: restype. "account" Required. - :type restype: str or ~azure.storage.blob.models.Enum8 - :param comp: comp. "properties" Required. - :type comp: str or ~azure.storage.blob.models.Enum1 + :keyword restype: restype. Default value is "account". Note that overriding this default value + may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -2717,8 +2744,10 @@ def get_account_info( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account")) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_get_account_info_request( diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py index 23ed0d6188b2..a212ba089831 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py @@ -44,7 +44,6 @@ def build_create_request( *, content_length: int, blob_content_length: int, - version: Union[str, _models.Enum2], timeout: Optional[int] = None, tier: Optional[Union[str, _models.PremiumPageBlobAccessTier]] = None, blob_content_type: Optional[str] = None, @@ -76,6 +75,7 @@ def build_create_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) blob_type: Literal["PageBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "PageBlob")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -163,10 +163,8 @@ def build_create_request( def build_upload_pages_request( url: str, *, - comp: Union[str, _models.Enum34], content_length: int, content: IO, - version: Union[str, _models.Enum2], transactional_content_md5: Optional[bytes] = None, transactional_content_crc64: Optional[bytes] = None, timeout: Optional[int] = None, @@ -190,8 +188,10 @@ def build_upload_pages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page")) page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -267,9 +267,7 @@ def build_upload_pages_request( def build_clear_pages_request( url: str, *, - comp: Union[str, _models.Enum34], content_length: int, - version: Union[str, _models.Enum2], timeout: Optional[int] = None, range: Optional[str] = None, lease_id: Optional[str] = None, @@ -291,7 +289,9 @@ def build_clear_pages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page")) page_write: Literal["clear"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "clear")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -357,12 +357,10 @@ def build_clear_pages_request( def build_upload_pages_from_url_request( url: str, *, - comp: Union[str, _models.Enum34], source_url: str, source_range: str, content_length: int, range: str, - version: Union[str, _models.Enum2], source_content_md5: Optional[bytes] = None, source_contentcrc64: Optional[bytes] = None, timeout: Optional[int] = None, @@ -390,7 +388,9 @@ def build_upload_pages_from_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page")) page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -479,8 +479,6 @@ def build_upload_pages_from_url_request( def build_get_page_ranges_request( url: str, *, - comp: Union[str, _models.Enum35], - version: Union[str, _models.Enum2], snapshot: Optional[str] = None, timeout: Optional[int] = None, range: Optional[str] = None, @@ -498,6 +496,8 @@ def build_get_page_ranges_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["pagelist"] = kwargs.pop("comp", _params.pop("comp", "pagelist")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -545,8 +545,6 @@ def build_get_page_ranges_request( def build_get_page_ranges_diff_request( url: str, *, - comp: Union[str, _models.Enum35], - version: Union[str, _models.Enum2], snapshot: Optional[str] = None, timeout: Optional[int] = None, prevsnapshot: Optional[str] = None, @@ -566,6 +564,8 @@ def build_get_page_ranges_diff_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["pagelist"] = kwargs.pop("comp", _params.pop("comp", "pagelist")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -617,9 +617,7 @@ def build_get_page_ranges_diff_request( def build_resize_request( url: str, *, - comp: Union[str, _models.Enum1], blob_content_length: int, - version: Union[str, _models.Enum2], timeout: Optional[int] = None, lease_id: Optional[str] = None, encryption_key: Optional[str] = None, @@ -637,6 +635,8 @@ def build_resize_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -687,9 +687,7 @@ def build_resize_request( def build_update_sequence_number_request( url: str, *, - comp: Union[str, _models.Enum1], sequence_number_action: Union[str, _models.SequenceNumberActionType], - version: Union[str, _models.Enum2], timeout: Optional[int] = None, lease_id: Optional[str] = None, if_modified_since: Optional[datetime.datetime] = None, @@ -704,6 +702,8 @@ def build_update_sequence_number_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -748,9 +748,7 @@ def build_update_sequence_number_request( def build_copy_incremental_request( url: str, *, - comp: Union[str, _models.Enum36], copy_source: str, - version: Union[str, _models.Enum2], timeout: Optional[int] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -763,6 +761,8 @@ def build_copy_incremental_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["incrementalcopy"] = kwargs.pop("comp", _params.pop("comp", "incrementalcopy")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -955,7 +955,6 @@ def create( # pylint: disable=inconsistent-return-statements url=self._config.url, content_length=content_length, blob_content_length=blob_content_length, - version=self._config.version, timeout=timeout, tier=tier, blob_content_type=_blob_content_type, @@ -982,6 +981,7 @@ def create( # pylint: disable=inconsistent-return-statements immutability_policy_mode=immutability_policy_mode, legal_hold=legal_hold, blob_type=blob_type, + version=self._config.version, template_url=self.create.metadata["url"], headers=_headers, params=_params, @@ -1029,7 +1029,6 @@ def create( # pylint: disable=inconsistent-return-statements @distributed_trace def upload_pages( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum34], content_length: int, body: IO, transactional_content_md5: Optional[bytes] = None, @@ -1046,8 +1045,6 @@ def upload_pages( # pylint: disable=inconsistent-return-statements ) -> None: """The Upload Pages operation writes a range of pages to a page blob. - :param comp: comp. "page" Required. - :type comp: str or ~azure.storage.blob.models.Enum34 :param content_length: The length of the request. Required. :type content_length: int :param body: Initial data. Required. @@ -1080,6 +1077,9 @@ def upload_pages( # pylint: disable=inconsistent-return-statements ~azure.storage.blob.models.SequenceNumberAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "page". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword page_write: Required. You may specify one of the following options: @@ -1104,8 +1104,9 @@ def upload_pages( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page")) page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1147,9 +1148,7 @@ def upload_pages( # pylint: disable=inconsistent-return-statements request = build_upload_pages_request( url=self._config.url, - comp=comp, content_length=content_length, - version=self._config.version, transactional_content_md5=transactional_content_md5, transactional_content_crc64=transactional_content_crc64, timeout=timeout, @@ -1168,8 +1167,10 @@ def upload_pages( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, page_write=page_write, content_type=content_type, + version=self._config.version, content=_content, template_url=self.upload_pages.metadata["url"], headers=_headers, @@ -1223,7 +1224,6 @@ def upload_pages( # pylint: disable=inconsistent-return-statements @distributed_trace def clear_pages( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum34], content_length: int, timeout: Optional[int] = None, range: Optional[str] = None, @@ -1237,8 +1237,6 @@ def clear_pages( # pylint: disable=inconsistent-return-statements ) -> None: """The Clear Pages operation clears a set of pages from a page blob. - :param comp: comp. "page" Required. - :type comp: str or ~azure.storage.blob.models.Enum34 :param content_length: The length of the request. Required. :type content_length: int :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -1263,6 +1261,9 @@ def clear_pages( # pylint: disable=inconsistent-return-statements ~azure.storage.blob.models.SequenceNumberAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "page". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword page_write: Required. You may specify one of the following options: @@ -1287,8 +1288,9 @@ def clear_pages( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page")) page_write: Literal["clear"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "clear")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1328,9 +1330,7 @@ def clear_pages( # pylint: disable=inconsistent-return-statements request = build_clear_pages_request( url=self._config.url, - comp=comp, content_length=content_length, - version=self._config.version, timeout=timeout, range=range, lease_id=_lease_id, @@ -1347,7 +1347,9 @@ def clear_pages( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, page_write=page_write, + version=self._config.version, template_url=self.clear_pages.metadata["url"], headers=_headers, params=_params, @@ -1391,7 +1393,6 @@ def clear_pages( # pylint: disable=inconsistent-return-statements @distributed_trace def upload_pages_from_url( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum34], source_url: str, source_range: str, content_length: int, @@ -1412,8 +1413,6 @@ def upload_pages_from_url( # pylint: disable=inconsistent-return-statements """The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL. - :param comp: comp. "page" Required. - :type comp: str or ~azure.storage.blob.models.Enum34 :param source_url: Specify a URL to the copy source. Required. :type source_url: str :param source_range: Bytes of source data in the specified range. The length of this range @@ -1456,6 +1455,9 @@ def upload_pages_from_url( # pylint: disable=inconsistent-return-statements :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions + :keyword comp: comp. Default value is "page". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword page_write: Required. You may specify one of the following options: @@ -1480,8 +1482,9 @@ def upload_pages_from_url( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page")) page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1530,12 +1533,10 @@ def upload_pages_from_url( # pylint: disable=inconsistent-return-statements request = build_upload_pages_from_url_request( url=self._config.url, - comp=comp, source_url=source_url, source_range=source_range, content_length=content_length, range=range, - version=self._config.version, source_content_md5=source_content_md5, source_contentcrc64=source_contentcrc64, timeout=timeout, @@ -1558,7 +1559,9 @@ def upload_pages_from_url( # pylint: disable=inconsistent-return-statements source_if_none_match=_source_if_none_match, request_id_parameter=request_id_parameter, copy_source_authorization=copy_source_authorization, + comp=comp, page_write=page_write, + version=self._config.version, template_url=self.upload_pages_from_url.metadata["url"], headers=_headers, params=_params, @@ -1608,7 +1611,6 @@ def upload_pages_from_url( # pylint: disable=inconsistent-return-statements @distributed_trace def get_page_ranges( self, - comp: Union[str, _models.Enum35], snapshot: Optional[str] = None, timeout: Optional[int] = None, range: Optional[str] = None, @@ -1622,8 +1624,6 @@ def get_page_ranges( """The Get Page Ranges operation returns the list of valid page ranges for a page blob or snapshot of a page blob. - :param comp: comp. "pagelist" Required. - :type comp: str or ~azure.storage.blob.models.Enum35 :param snapshot: The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:` None: """Resize the Blob. - :param comp: comp. "properties" Required. - :type comp: str or ~azure.storage.blob.models.Enum1 :param blob_content_length: This header specifies the maximum size for the page blob, up to 1 TB. The page blob size must be aligned to a 512-byte boundary. Required. :type blob_content_length: int @@ -1944,6 +1946,9 @@ def resize( # pylint: disable=inconsistent-return-statements :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -1958,8 +1963,9 @@ def resize( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None @@ -1989,9 +1995,7 @@ def resize( # pylint: disable=inconsistent-return-statements request = build_resize_request( url=self._config.url, - comp=comp, blob_content_length=blob_content_length, - version=self._config.version, timeout=timeout, lease_id=_lease_id, encryption_key=_encryption_key, @@ -2004,6 +2008,8 @@ def resize( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, + version=self._config.version, template_url=self.resize.metadata["url"], headers=_headers, params=_params, @@ -2043,7 +2049,6 @@ def resize( # pylint: disable=inconsistent-return-statements @distributed_trace def update_sequence_number( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum1], sequence_number_action: Union[str, _models.SequenceNumberActionType], timeout: Optional[int] = None, blob_sequence_number: int = 0, @@ -2054,8 +2059,6 @@ def update_sequence_number( # pylint: disable=inconsistent-return-statements ) -> None: """Update the sequence number of the blob. - :param comp: comp. "properties" Required. - :type comp: str or ~azure.storage.blob.models.Enum1 :param sequence_number_action: Required if the x-ms-blob-sequence-number header is set for the request. This property applies to page blobs only. This property indicates how the service should modify the blob's sequence number. Known values are: "max", "update", and "increment". @@ -2078,6 +2081,9 @@ def update_sequence_number( # pylint: disable=inconsistent-return-statements :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -2092,8 +2098,9 @@ def update_sequence_number( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) cls: ClsType[None] = kwargs.pop("cls", None) _lease_id = None @@ -2113,9 +2120,7 @@ def update_sequence_number( # pylint: disable=inconsistent-return-statements request = build_update_sequence_number_request( url=self._config.url, - comp=comp, sequence_number_action=sequence_number_action, - version=self._config.version, timeout=timeout, lease_id=_lease_id, if_modified_since=_if_modified_since, @@ -2125,6 +2130,8 @@ def update_sequence_number( # pylint: disable=inconsistent-return-statements if_tags=_if_tags, blob_sequence_number=blob_sequence_number, request_id_parameter=request_id_parameter, + comp=comp, + version=self._config.version, template_url=self.update_sequence_number.metadata["url"], headers=_headers, params=_params, @@ -2164,7 +2171,6 @@ def update_sequence_number( # pylint: disable=inconsistent-return-statements @distributed_trace def copy_incremental( # pylint: disable=inconsistent-return-statements self, - comp: Union[str, _models.Enum36], copy_source: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -2177,8 +2183,6 @@ def copy_incremental( # pylint: disable=inconsistent-return-statements the original snapshot and can be read or copied from as usual. This API is supported since REST version 2016-05-31. - :param comp: comp. "incrementalcopy" Required. - :type comp: str or ~azure.storage.blob.models.Enum36 :param copy_source: Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated @@ -2195,6 +2199,9 @@ def copy_incremental( # pylint: disable=inconsistent-return-statements :type request_id_parameter: str :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. Default value is "incrementalcopy". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -2209,8 +2216,9 @@ def copy_incremental( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["incrementalcopy"] = kwargs.pop("comp", _params.pop("comp", "incrementalcopy")) cls: ClsType[None] = kwargs.pop("cls", None) _if_modified_since = None @@ -2227,9 +2235,7 @@ def copy_incremental( # pylint: disable=inconsistent-return-statements request = build_copy_incremental_request( url=self._config.url, - comp=comp, copy_source=copy_source, - version=self._config.version, timeout=timeout, if_modified_since=_if_modified_since, if_unmodified_since=_if_unmodified_since, @@ -2237,6 +2243,8 @@ def copy_incremental( # pylint: disable=inconsistent-return-statements if_none_match=_if_none_match, if_tags=_if_tags, request_id_parameter=request_id_parameter, + comp=comp, + version=self._config.version, template_url=self.copy_incremental.metadata["url"], headers=_headers, params=_params, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py index 3fac19e02614..d702b2c8cf0f 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_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. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterator, List, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -34,20 +39,15 @@ def build_set_properties_request( - url: str, - *, - restype: Union[str, _models.Enum0], - comp: Union[str, _models.Enum1], - content: Any, - version: Union[str, _models.Enum2], - timeout: Optional[int] = None, - request_id_parameter: Optional[str] = None, - **kwargs: Any + url: str, *, content: Any, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -76,18 +76,14 @@ def build_set_properties_request( def build_get_properties_request( - url: str, - *, - restype: Union[str, _models.Enum0], - comp: Union[str, _models.Enum1], - version: Union[str, _models.Enum2], - timeout: Optional[int] = None, - request_id_parameter: Optional[str] = None, - **kwargs: Any + url: str, *, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -114,18 +110,14 @@ def build_get_properties_request( def build_get_statistics_request( - url: str, - *, - restype: Union[str, _models.Enum0], - comp: Union[str, _models.Enum3], - version: Union[str, _models.Enum2], - timeout: Optional[int] = None, - request_id_parameter: Optional[str] = None, - **kwargs: Any + url: str, *, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) + comp: Literal["stats"] = kwargs.pop("comp", _params.pop("comp", "stats")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -154,8 +146,6 @@ def build_get_statistics_request( def build_list_containers_segment_request( url: str, *, - comp: Union[str, _models.Enum5], - version: Union[str, _models.Enum2], prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, @@ -167,6 +157,8 @@ def build_list_containers_segment_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -200,20 +192,15 @@ def build_list_containers_segment_request( def build_get_user_delegation_key_request( - url: str, - *, - restype: Union[str, _models.Enum0], - comp: Union[str, _models.Enum7], - content: Any, - version: Union[str, _models.Enum2], - timeout: Optional[int] = None, - request_id_parameter: Optional[str] = None, - **kwargs: Any + url: str, *, content: Any, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) + comp: Literal["userdelegationkey"] = kwargs.pop("comp", _params.pop("comp", "userdelegationkey")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -241,17 +228,13 @@ def build_get_user_delegation_key_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, content=content, **kwargs) -def build_get_account_info_request( - url: str, - *, - restype: Union[str, _models.Enum8], - comp: Union[str, _models.Enum1], - version: Union[str, _models.Enum2], - **kwargs: Any -) -> HttpRequest: +def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account")) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -276,10 +259,8 @@ def build_get_account_info_request( def build_submit_batch_request( url: str, *, - comp: Union[str, _models.Enum9], content_length: int, content: IO, - version: Union[str, _models.Enum2], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any @@ -287,7 +268,9 @@ def build_submit_batch_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["batch"] = kwargs.pop("comp", _params.pop("comp", "batch")) multipart_content_type: Optional[str] = kwargs.pop("multipart_content_type", _headers.pop("Content-Type", None)) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -318,8 +301,6 @@ def build_submit_batch_request( def build_filter_blobs_request( url: str, *, - comp: Union[str, _models.Enum10], - version: Union[str, _models.Enum2], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, where: Optional[str] = None, @@ -331,6 +312,8 @@ def build_filter_blobs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["blobs"] = kwargs.pop("comp", _params.pop("comp", "blobs")) + version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -385,8 +368,6 @@ def __init__(self, *args, **kwargs): @distributed_trace def set_properties( # pylint: disable=inconsistent-return-statements self, - restype: Union[str, _models.Enum0], - comp: Union[str, _models.Enum1], storage_service_properties: _models.StorageServiceProperties, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -395,10 +376,6 @@ def set_properties( # pylint: disable=inconsistent-return-statements """Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. - :param restype: restype. "service" Required. - :type restype: str or ~azure.storage.blob.models.Enum0 - :param comp: comp. "properties" Required. - :type comp: str or ~azure.storage.blob.models.Enum1 :param storage_service_properties: The StorageService properties. Required. :type storage_service_properties: ~azure.storage.blob.models.StorageServiceProperties :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -410,6 +387,12 @@ def set_properties( # pylint: disable=inconsistent-return-statements limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword restype: restype. Default value is "service". Note that overriding this default value + may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -424,8 +407,10 @@ def set_properties( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) cls: ClsType[None] = kwargs.pop("cls", None) @@ -433,12 +418,12 @@ def set_properties( # pylint: disable=inconsistent-return-statements request = build_set_properties_request( url=self._config.url, - restype=restype, - comp=comp, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, + restype=restype, + comp=comp, content_type=content_type, + version=self._config.version, content=_content, template_url=self.set_properties.metadata["url"], headers=_headers, @@ -472,20 +457,11 @@ def set_properties( # pylint: disable=inconsistent-return-statements @distributed_trace def get_properties( - self, - restype: Union[str, _models.Enum0], - comp: Union[str, _models.Enum1], - timeout: Optional[int] = None, - request_id_parameter: Optional[str] = None, - **kwargs: Any + self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> _models.StorageServiceProperties: """gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. - :param restype: restype. "service" Required. - :type restype: str or ~azure.storage.blob.models.Enum0 - :param comp: comp. "properties" Required. - :type comp: str or ~azure.storage.blob.models.Enum1 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -495,6 +471,12 @@ def get_properties( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword restype: restype. Default value is "service". Note that overriding this default value + may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceProperties or the result of cls(response) :rtype: ~azure.storage.blob.models.StorageServiceProperties @@ -509,17 +491,19 @@ def get_properties( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) cls: ClsType[_models.StorageServiceProperties] = kwargs.pop("cls", None) request = build_get_properties_request( url=self._config.url, + timeout=timeout, + request_id_parameter=request_id_parameter, restype=restype, comp=comp, version=self._config.version, - timeout=timeout, - request_id_parameter=request_id_parameter, template_url=self.get_properties.metadata["url"], headers=_headers, params=_params, @@ -556,21 +540,12 @@ def get_properties( @distributed_trace def get_statistics( - self, - restype: Union[str, _models.Enum0], - comp: Union[str, _models.Enum3], - timeout: Optional[int] = None, - request_id_parameter: Optional[str] = None, - **kwargs: Any + self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any ) -> _models.StorageServiceStats: """Retrieves statistics related to replication for the Blob service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account. - :param restype: restype. "service" Required. - :type restype: str or ~azure.storage.blob.models.Enum0 - :param comp: comp. "stats" Required. - :type comp: str or ~azure.storage.blob.models.Enum3 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -580,6 +555,12 @@ def get_statistics( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword restype: restype. Default value is "service". Note that overriding this default value + may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "stats". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceStats or the result of cls(response) :rtype: ~azure.storage.blob.models.StorageServiceStats @@ -594,17 +575,19 @@ def get_statistics( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) + comp: Literal["stats"] = kwargs.pop("comp", _params.pop("comp", "stats")) cls: ClsType[_models.StorageServiceStats] = kwargs.pop("cls", None) request = build_get_statistics_request( url=self._config.url, + timeout=timeout, + request_id_parameter=request_id_parameter, restype=restype, comp=comp, version=self._config.version, - timeout=timeout, - request_id_parameter=request_id_parameter, template_url=self.get_statistics.metadata["url"], headers=_headers, params=_params, @@ -643,7 +626,6 @@ def get_statistics( @distributed_trace def list_containers_segment( self, - comp: Union[str, _models.Enum5], prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, @@ -655,8 +637,6 @@ def list_containers_segment( """The List Containers Segment operation returns a list of the containers under the specified account. - :param comp: comp. "list" Required. - :type comp: str or ~azure.storage.blob.models.Enum5 :param prefix: Filters the results to return only containers whose name begins with the specified prefix. Default value is None. :type prefix: str @@ -686,6 +666,9 @@ def list_containers_segment( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword comp: comp. Default value is "list". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListContainersSegmentResponse or the result of cls(response) :rtype: ~azure.storage.blob.models.ListContainersSegmentResponse @@ -700,20 +683,21 @@ def list_containers_segment( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) cls: ClsType[_models.ListContainersSegmentResponse] = kwargs.pop("cls", None) request = build_list_containers_segment_request( url=self._config.url, - comp=comp, - version=self._config.version, prefix=prefix, marker=marker, maxresults=maxresults, include=include, timeout=timeout, request_id_parameter=request_id_parameter, + comp=comp, + version=self._config.version, template_url=self.list_containers_segment.metadata["url"], headers=_headers, params=_params, @@ -751,8 +735,6 @@ def list_containers_segment( @distributed_trace def get_user_delegation_key( self, - restype: Union[str, _models.Enum0], - comp: Union[str, _models.Enum7], key_info: _models.KeyInfo, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -761,10 +743,6 @@ def get_user_delegation_key( """Retrieves a user delegation key for the Blob service. This is only a valid operation when using bearer token authentication. - :param restype: restype. "service" Required. - :type restype: str or ~azure.storage.blob.models.Enum0 - :param comp: comp. "userdelegationkey" Required. - :type comp: str or ~azure.storage.blob.models.Enum7 :param key_info: Key information. Required. :type key_info: ~azure.storage.blob.models.KeyInfo :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -776,6 +754,12 @@ def get_user_delegation_key( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword restype: restype. Default value is "service". Note that overriding this default value + may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "userdelegationkey". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: UserDelegationKey or the result of cls(response) :rtype: ~azure.storage.blob.models.UserDelegationKey @@ -790,8 +774,10 @@ def get_user_delegation_key( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) + comp: Literal["userdelegationkey"] = kwargs.pop("comp", _params.pop("comp", "userdelegationkey")) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) cls: ClsType[_models.UserDelegationKey] = kwargs.pop("cls", None) @@ -799,12 +785,12 @@ def get_user_delegation_key( request = build_get_user_delegation_key_request( url=self._config.url, - restype=restype, - comp=comp, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, + restype=restype, + comp=comp, content_type=content_type, + version=self._config.version, content=_content, template_url=self.get_user_delegation_key.metadata["url"], headers=_headers, @@ -842,15 +828,15 @@ def get_user_delegation_key( get_user_delegation_key.metadata = {"url": "{url}"} @distributed_trace - def get_account_info( # pylint: disable=inconsistent-return-statements - self, restype: Union[str, _models.Enum8], comp: Union[str, _models.Enum1], **kwargs: Any - ) -> None: + def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements """Returns the sku name and account kind. - :param restype: restype. "account" Required. - :type restype: str or ~azure.storage.blob.models.Enum8 - :param comp: comp. "properties" Required. - :type comp: str or ~azure.storage.blob.models.Enum1 + :keyword restype: restype. Default value is "account". Note that overriding this default value + may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None @@ -865,8 +851,10 @@ def get_account_info( # pylint: disable=inconsistent-return-statements error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account")) + comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_get_account_info_request( @@ -911,7 +899,6 @@ def get_account_info( # pylint: disable=inconsistent-return-statements @distributed_trace def submit_batch( self, - comp: Union[str, _models.Enum9], content_length: int, body: IO, timeout: Optional[int] = None, @@ -920,8 +907,6 @@ def submit_batch( ) -> Iterator[bytes]: """The Batch operation allows multiple API calls to be embedded into a single HTTP request. - :param comp: comp. "batch" Required. - :type comp: str or ~azure.storage.blob.models.Enum9 :param content_length: The length of the request. Required. :type content_length: int :param body: Initial data. Required. @@ -935,6 +920,9 @@ def submit_batch( limit that is recorded in the analytics logs when storage analytics logging is enabled. Default value is None. :type request_id_parameter: str + :keyword comp: comp. Default value is "batch". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Iterator of the response bytes or the result of cls(response) :rtype: Iterator[bytes] @@ -949,8 +937,9 @@ def submit_batch( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["batch"] = kwargs.pop("comp", _params.pop("comp", "batch")) multipart_content_type: str = kwargs.pop( "multipart_content_type", _headers.pop("Content-Type", "application/xml") ) @@ -960,12 +949,12 @@ def submit_batch( request = build_submit_batch_request( url=self._config.url, - comp=comp, content_length=content_length, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, + comp=comp, multipart_content_type=multipart_content_type, + version=self._config.version, content=_content, template_url=self.submit_batch.metadata["url"], headers=_headers, @@ -1002,7 +991,6 @@ def submit_batch( @distributed_trace def filter_blobs( self, - comp: Union[str, _models.Enum10], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, where: Optional[str] = None, @@ -1015,8 +1003,6 @@ def filter_blobs( a given search expression. Filter blobs searches across all containers within a storage account but can be scoped within the expression to a single container. - :param comp: comp. "blobs" Required. - :type comp: str or ~azure.storage.blob.models.Enum10 :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting @@ -1046,6 +1032,9 @@ def filter_blobs( :param include: Include this parameter to specify one or more datasets to include in the response. Default value is None. :type include: list[str or ~azure.storage.blob.models.FilterBlobsIncludeItem] + :keyword comp: comp. Default value is "blobs". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FilterBlobSegment or the result of cls(response) :rtype: ~azure.storage.blob.models.FilterBlobSegment @@ -1060,20 +1049,21 @@ def filter_blobs( error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + comp: Literal["blobs"] = kwargs.pop("comp", _params.pop("comp", "blobs")) cls: ClsType[_models.FilterBlobSegment] = kwargs.pop("cls", None) request = build_filter_blobs_request( url=self._config.url, - comp=comp, - version=self._config.version, timeout=timeout, request_id_parameter=request_id_parameter, where=where, marker=marker, maxresults=maxresults, include=include, + comp=comp, + version=self._config.version, template_url=self.filter_blobs.metadata["url"], headers=_headers, params=_params, diff --git a/sdk/storage/azure-storage-blob/swagger/README.md b/sdk/storage/azure-storage-blob/swagger/README.md index af133f0f5a44..c3dfebfb826b 100644 --- a/sdk/storage/azure-storage-blob/swagger/README.md +++ b/sdk/storage/azure-storage-blob/swagger/README.md @@ -26,6 +26,8 @@ vanilla: true clear-output-folder: true python: true version-tolerant: false +modelerfour: + seal-single-value-enum-by-default: true ``` ### Remove x-ms-pageable From 0868396b98c40420a2c463b65230c17d34c88a1b Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Thu, 16 Feb 2023 14:38:50 -0800 Subject: [PATCH 3/5] Swagger on 6.1.4 autorest --- .../azure/storage/blob/_generated/__init__.py | 6 +- .../blob/_generated/_azure_blob_storage.py | 13 +- .../storage/blob/_generated/_configuration.py | 13 +- .../storage/blob/_generated/_serialization.py | 174 ++--- .../azure/storage/blob/_generated/_vendor.py | 5 +- .../storage/blob/_generated/aio/__init__.py | 6 +- .../_generated/aio/_azure_blob_storage.py | 6 +- .../blob/_generated/aio/_configuration.py | 8 +- .../_generated/aio/operations/__init__.py | 2 +- .../aio/operations/_append_blob_operations.py | 78 +-- .../aio/operations/_blob_operations.py | 460 +++++-------- .../aio/operations/_block_blob_operations.py | 128 ++-- .../aio/operations/_container_operations.py | 372 ++++------ .../aio/operations/_page_blob_operations.py | 173 ++--- .../aio/operations/_service_operations.py | 168 ++--- .../blob/_generated/models/__init__.py | 2 +- .../blob/_generated/models/_models_py3.py | 194 +++--- .../blob/_generated/operations/__init__.py | 2 +- .../operations/_append_blob_operations.py | 112 ++- .../_generated/operations/_blob_operations.py | 650 +++++++----------- .../operations/_block_blob_operations.py | 194 +++--- .../operations/_container_operations.py | 536 ++++++--------- .../operations/_page_blob_operations.py | 251 +++---- .../operations/_service_operations.py | 238 +++---- 24 files changed, 1488 insertions(+), 2303 deletions(-) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/__init__.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/__init__.py index 62dc43a7722a..2064cc374929 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/__init__.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/__init__.py @@ -10,14 +10,12 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = [ - "AzureBlobStorage", -] +__all__ = ["AzureBlobStorage"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py index 6c24b7ba8661..1b841a23361b 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py @@ -12,7 +12,7 @@ from azure.core import PipelineClient from azure.core.rest import HttpRequest, HttpResponse -from . import models as _models +from . import models from ._configuration import AzureBlobStorageConfiguration from ._serialization import Deserializer, Serializer from .operations import ( @@ -56,7 +56,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self._config = AzureBlobStorageConfiguration(url=url, **kwargs) self._client = PipelineClient(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 @@ -89,12 +89,15 @@ 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) -> None: + def close(self): + # type: () -> None self._client.close() - def __enter__(self) -> "AzureBlobStorage": + def __enter__(self): + # type: () -> AzureBlobStorage self._client.__enter__() return self - def __exit__(self, *exc_details: Any) -> None: + def __exit__(self, *exc_details): + # type: (Any) -> None self._client.__exit__(*exc_details) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py index 4f9875f45247..bde75f02cd57 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py @@ -6,17 +6,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any from azure.core.configuration import Configuration from azure.core.pipeline import policies -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - VERSION = "unknown" @@ -36,7 +30,7 @@ class AzureBlobStorageConfiguration(Configuration): # pylint: disable=too-many- def __init__(self, url: str, **kwargs: Any) -> None: super(AzureBlobStorageConfiguration, self).__init__(**kwargs) - version: Literal["2021-12-02"] = kwargs.pop("version", "2021-12-02") + version = kwargs.pop("version", "2021-12-02") # type: str if url is None: raise ValueError("Parameter 'url' must not be None.") @@ -46,7 +40,10 @@ def __init__(self, url: str, **kwargs: Any) -> None: kwargs.setdefault("sdk_moniker", "azureblobstorage/{}".format(VERSION)) self._configure(**kwargs) - def _configure(self, **kwargs: Any) -> None: + def _configure( + self, **kwargs # type: Any + ): + # type: (...) -> None self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_serialization.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_serialization.py index f17c068e833e..7c1dedb5133d 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_serialization.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_serialization.py @@ -25,7 +25,6 @@ # -------------------------------------------------------------------------- # pylint: skip-file -# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -38,38 +37,23 @@ 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 + from urllib.parse import quote # type: ignore import xml.etree.ElementTree as ET -import isodate # type: ignore +import isodate + +from typing import Dict, Any, cast, TYPE_CHECKING 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") -ModelType = TypeVar("ModelType", bound="Model") -JSON = MutableMapping[str, Any] +if TYPE_CHECKING: + from typing import Optional, Union, AnyStr, IO, Mapping class RawDeserializer: @@ -81,7 +65,8 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + def deserialize_from_text(cls, data, content_type=None): + # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -147,7 +132,8 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + def deserialize_from_http_generics(cls, body_bytes, headers): + # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -174,8 +160,8 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str - unicode_str = str + basestring = str # type: ignore + unicode_str = str # type: ignore _LOGGER = logging.getLogger(__name__) @@ -202,7 +188,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset # type: ignore + from datetime import timezone as _FixedOffset except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -233,7 +219,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc + TZ_UTC = timezone.utc # type: ignore except ImportError: TZ_UTC = UTC() # type: ignore @@ -290,12 +276,12 @@ class Model(object): serialization and deserialization. """ - _subtype_map: Dict[str, Dict[str, Any]] = {} - _attribute_map: Dict[str, Dict[str, Any]] = {} - _validation: Dict[str, Dict[str, Any]] = {} + _subtype_map = {} # type: Dict[str, Dict[str, Any]] + _attribute_map = {} # type: Dict[str, Dict[str, Any]] + _validation = {} # type: Dict[str, Dict[str, Any]] - def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Dict[str, Any] = {} + def __init__(self, **kwargs): + self.additional_properties = {} 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__) @@ -304,27 +290,27 @@ def __init__(self, **kwargs: Any) -> None: else: setattr(self, k, kwargs[k]) - def __eq__(self, other: Any) -> bool: + def __eq__(self, other): """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other: Any) -> bool: + def __ne__(self, other): """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self) -> str: + def __str__(self): return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls) -> None: + def enable_additional_properties_sending(cls): cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls) -> bool: + def is_xml_model(cls): try: - cls._xml_map # type: ignore + cls._xml_map except AttributeError: return False return True @@ -333,13 +319,13 @@ def is_xml_model(cls) -> bool: def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map # type: ignore + xml_map = cls._xml_map 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: bool = False, **kwargs: Any) -> JSON: + def serialize(self, keep_readonly=False, **kwargs): """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)`. @@ -353,13 +339,8 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - 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. + def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): + """Return a dict that can be JSONify using json.dump. Advanced usage might optionally use a callback as parameter: @@ -406,7 +387,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + def deserialize(cls, data, content_type=None): """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -418,12 +399,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N return deserializer(cls.__name__, data, content_type=content_type) @classmethod - 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: + def from_dict(cls, data, key_extractors=None, content_type=None): """Parse a dict using given key extractor return a model. By default consider key @@ -436,8 +412,8 @@ def from_dict( :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore + deserializer.key_extractors = ( + [ attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -477,7 +453,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]] # type: ignore + return objects[flatten_mapping_type[subtype_value]] except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -545,7 +521,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes=None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +537,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -630,13 +606,13 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore + serialized.set(xml_name, new_attr) continue if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore + serialized.text = new_attr continue if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore + serialized.extend(new_attr) elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): @@ -645,22 +621,23 @@ 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) # type: ignore + serialized.append(new_attr) else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) # type: ignore + serialized.append(local_node) else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} + for k in reversed(keys): + unflattened = {k: new_attr} + new_attr = unflattened _new_attr = new_attr _serialized = serialized - for k in keys: # type: ignore + for k in keys: if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore + _serialized.update(_new_attr) + _new_attr = _new_attr[k] _serialized = _serialized[k] except ValueError: continue @@ -682,8 +659,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) + internal_data_type = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -698,7 +675,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 = [ # type: ignore + deserializer.key_extractors = [ attribute_key_case_insensitive_extractor, ] else: @@ -803,8 +780,6 @@ 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) @@ -868,7 +843,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): # type: ignore + if isinstance(data, unicode): # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -1026,10 +1001,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) # type: ignore + enum_obj(result) return result except ValueError: - for enum_value in enum_obj: # type: ignore + for enum_value in enum_obj: if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1189,8 +1164,7 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(List[str], _FLATTEN.split(key)) + dict_keys = _FLATTEN.split(key) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1361,7 +1335,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: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes=None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1381,7 +1355,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1442,7 +1416,7 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1470,7 +1444,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 # type: ignore + msg = "Unable to deserialize to object: " + class_name raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1500,7 +1474,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 deserialize. + :param str/dict data: The response data to deseralize. """ if target is None: return None, None @@ -1515,7 +1489,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__ # type: ignore + return target, target.__class__.__name__ def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1525,7 +1499,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 deserialize. + :param str/dict data: The response data to deseralize. :param str content_type: Swagger "produces" if available. """ try: @@ -1569,7 +1543,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) # type: ignore + return RawDeserializer.deserialize_from_text(raw_data, content_type) return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1591,7 +1565,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) # type: ignore + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) raise DeserializationError(msg + str(err)) else: try: @@ -1773,7 +1747,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): # type: ignore + if isinstance(data, unicode): return data except NameError: return str(data) @@ -1824,7 +1798,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) # type: ignore + return bytearray(b64decode(attr)) @staticmethod def deserialize_base64(attr): @@ -1836,8 +1810,8 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore + padding = "=" * (3 - (len(attr) + 3) % 4) + attr = attr + padding encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @@ -1852,7 +1826,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(attr) except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1867,7 +1841,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) # type: ignore + return _long_type(attr) @staticmethod def deserialize_duration(attr): @@ -1897,7 +1871,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + if re.search(r"[^\W\d_]", attr, re.I + re.U): raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. return isodate.parse_date(attr, defaultmonth=None, defaultday=None) @@ -1912,7 +1886,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + if re.search(r"[^\W\d_]", attr, re.I + re.U): raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1927,7 +1901,7 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore + parsed_date = email.utils.parsedate_tz(attr) date_obj = datetime.datetime( *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) @@ -1950,7 +1924,7 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() # type: ignore + attr = attr.upper() match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) @@ -1986,7 +1960,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore + attr = int(attr.text) try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_vendor.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_vendor.py index bd0df84f5319..9aad73fc743e 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_vendor.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -24,7 +22,6 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) + formatted_components = template.split("/") components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/__init__.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/__init__.py index 62dc43a7722a..2064cc374929 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/__init__.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/__init__.py @@ -10,14 +10,12 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = [ - "AzureBlobStorage", -] +__all__ = ["AzureBlobStorage"] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py index 8b3aa72b6060..8fbb8e5a4a11 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py @@ -12,7 +12,7 @@ from azure.core import AsyncPipelineClient from azure.core.rest import AsyncHttpResponse, HttpRequest -from .. import models as _models +from .. import models from .._serialization import Deserializer, Serializer from ._configuration import AzureBlobStorageConfiguration from .operations import ( @@ -56,7 +56,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self._config = AzureBlobStorageConfiguration(url=url, **kwargs) self._client = AsyncPipelineClient(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 @@ -96,5 +96,5 @@ async def __aenter__(self) -> "AzureBlobStorage": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details: Any) -> None: + async def __aexit__(self, *exc_details) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py index efe9a7c79106..3ba2c071221a 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py @@ -6,17 +6,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any from azure.core.configuration import Configuration from azure.core.pipeline import policies -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - VERSION = "unknown" @@ -36,7 +30,7 @@ class AzureBlobStorageConfiguration(Configuration): # pylint: disable=too-many- def __init__(self, url: str, **kwargs: Any) -> None: super(AzureBlobStorageConfiguration, self).__init__(**kwargs) - version: Literal["2021-12-02"] = kwargs.pop("version", "2021-12-02") + version = kwargs.pop("version", "2021-12-02") # type: str if url is None: raise ValueError("Parameter 'url' must not be None.") diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/__init__.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/__init__.py index 1be05c7aa9a7..f8feb32687ac 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/__init__.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/__init__.py @@ -14,7 +14,7 @@ from ._block_blob_operations import BlockBlobOperations from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py index d7e2b679161f..734f15132967 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py @@ -7,7 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -15,7 +14,6 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, - ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -33,10 +31,6 @@ build_seal_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,7 +63,7 @@ async def create( # pylint: disable=inconsistent-return-statements request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, + immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, legal_hold: Optional[bool] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -129,19 +123,14 @@ async def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - blob_type: Literal["AppendBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "AppendBlob")) - cls: ClsType[None] = kwargs.pop("cls", None) + blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "AppendBlob")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _blob_content_type = None _blob_content_encoding = None @@ -214,9 +203,9 @@ async def create( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -251,7 +240,7 @@ async def create( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {"url": "{url}/{containerName}/{blob}"} + create.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def append_block( # pylint: disable=inconsistent-return-statements @@ -311,20 +300,15 @@ async def append_block( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["appendblock"] = kwargs.pop("comp", _params.pop("comp", "appendblock")) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "appendblock")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _max_size = None @@ -385,9 +369,9 @@ async def append_block( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -430,7 +414,7 @@ async def append_block( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - append_block.metadata = {"url": "{url}/{containerName}/{blob}"} + append_block.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def append_block_from_url( # pylint: disable=inconsistent-return-statements @@ -506,19 +490,14 @@ async def append_block_from_url( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["appendblock"] = kwargs.pop("comp", _params.pop("comp", "appendblock")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "appendblock")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _encryption_key = None _encryption_key_sha256 = None @@ -593,9 +572,9 @@ async def append_block_from_url( # pylint: disable=inconsistent-return-statemen params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -635,7 +614,7 @@ async def append_block_from_url( # pylint: disable=inconsistent-return-statemen if cls: return cls(pipeline_response, None, response_headers) - append_block_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} + append_block_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def seal( # pylint: disable=inconsistent-return-statements @@ -674,19 +653,14 @@ async def seal( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["seal"] = kwargs.pop("comp", _params.pop("comp", "seal")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "seal")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _if_modified_since = None @@ -721,9 +695,9 @@ async def seal( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -748,4 +722,4 @@ async def seal( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - seal.metadata = {"url": "{url}/{containerName}/{blob}"} + seal.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py index e0392aad9b30..92c70b4d5f87 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py @@ -7,7 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys from typing import Any, AsyncIterator, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -15,7 +14,6 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, - ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -53,10 +51,6 @@ build_undelete_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -138,18 +132,13 @@ async def download( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls = kwargs.pop("cls", None) # type: ClsType[AsyncIterator[bytes]] _lease_id = None _encryption_key = None @@ -197,9 +186,9 @@ async def download( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=True, **kwargs ) @@ -377,11 +366,11 @@ async def download( deserialized = response.stream_download(self._client._pipeline) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) - return deserialized # type: ignore + return deserialized - download.metadata = {"url": "{url}/{containerName}/{blob}"} + download.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def get_properties( # pylint: disable=inconsistent-return-statements @@ -428,18 +417,13 @@ async def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _encryption_key = None @@ -484,9 +468,9 @@ async def get_properties( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -587,7 +571,7 @@ async def get_properties( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {"url": "{url}/{containerName}/{blob}"} + get_properties.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -595,9 +579,9 @@ async def delete( # pylint: disable=inconsistent-return-statements snapshot: Optional[str] = None, version_id: Optional[str] = None, timeout: Optional[int] = None, - delete_snapshots: Optional[Union[str, _models.DeleteSnapshotsOptionType]] = None, + delete_snapshots: Optional[Union[str, "_models.DeleteSnapshotsOptionType"]] = None, request_id_parameter: Optional[str] = None, - blob_delete_type: Literal["Permanent"] = "Permanent", + blob_delete_type: str = "Permanent", lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, **kwargs: Any @@ -652,18 +636,13 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _if_modified_since = None @@ -700,9 +679,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -724,7 +703,7 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {"url": "{url}/{containerName}/{blob}"} + delete.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def undelete( # pylint: disable=inconsistent-return-statements @@ -749,19 +728,14 @@ async def undelete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["undelete"] = kwargs.pop("comp", _params.pop("comp", "undelete")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "undelete")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_undelete_request( url=self._config.url, @@ -774,9 +748,9 @@ async def undelete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -798,12 +772,12 @@ async def undelete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - undelete.metadata = {"url": "{url}/{containerName}/{blob}"} + undelete.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def set_expiry( # pylint: disable=inconsistent-return-statements self, - expiry_options: Union[str, _models.BlobExpiryOptions], + expiry_options: Union[str, "_models.BlobExpiryOptions"], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, expires_on: Optional[str] = None, @@ -833,19 +807,14 @@ async def set_expiry( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["expiry"] = kwargs.pop("comp", _params.pop("comp", "expiry")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "expiry")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_set_expiry_request( url=self._config.url, @@ -860,9 +829,9 @@ async def set_expiry( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -886,7 +855,7 @@ async def set_expiry( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_expiry.metadata = {"url": "{url}/{containerName}/{blob}"} + set_expiry.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def set_http_headers( # pylint: disable=inconsistent-return-statements @@ -923,19 +892,14 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _blob_cache_control = None _blob_content_type = None @@ -988,9 +952,9 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1017,7 +981,7 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_http_headers.metadata = {"url": "{url}/{containerName}/{blob}"} + set_http_headers.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def set_immutability_policy( # pylint: disable=inconsistent-return-statements @@ -1025,7 +989,7 @@ async def set_immutability_policy( # pylint: disable=inconsistent-return-statem timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, + immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, **kwargs: Any ) -> None: @@ -1056,19 +1020,14 @@ async def set_immutability_policy( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["immutabilityPolicies"] = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_unmodified_since = None if modified_access_conditions is not None: @@ -1088,9 +1047,9 @@ async def set_immutability_policy( # pylint: disable=inconsistent-return-statem params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1118,7 +1077,7 @@ async def set_immutability_policy( # pylint: disable=inconsistent-return-statem if cls: return cls(pipeline_response, None, response_headers) - set_immutability_policy.metadata = {"url": "{url}/{containerName}/{blob}"} + set_immutability_policy.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def delete_immutability_policy( # pylint: disable=inconsistent-return-statements @@ -1143,19 +1102,14 @@ async def delete_immutability_policy( # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["immutabilityPolicies"] = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_immutability_policy_request( url=self._config.url, @@ -1168,9 +1122,9 @@ async def delete_immutability_policy( # pylint: disable=inconsistent-return-sta params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1192,7 +1146,7 @@ async def delete_immutability_policy( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, response_headers) - delete_immutability_policy.metadata = {"url": "{url}/{containerName}/{blob}"} + delete_immutability_policy.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def set_legal_hold( # pylint: disable=inconsistent-return-statements @@ -1219,19 +1173,14 @@ async def set_legal_hold( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["legalhold"] = kwargs.pop("comp", _params.pop("comp", "legalhold")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "legalhold")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_set_legal_hold_request( url=self._config.url, @@ -1245,9 +1194,9 @@ async def set_legal_hold( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1270,7 +1219,7 @@ async def set_legal_hold( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_legal_hold.metadata = {"url": "{url}/{containerName}/{blob}"} + set_legal_hold.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def set_metadata( # pylint: disable=inconsistent-return-statements @@ -1320,19 +1269,14 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "metadata")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _encryption_key = None @@ -1381,9 +1325,9 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1417,7 +1361,7 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_metadata.metadata = {"url": "{url}/{containerName}/{blob}"} + set_metadata.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def acquire_lease( # pylint: disable=inconsistent-return-statements @@ -1462,20 +1406,15 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -1508,9 +1447,9 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1535,7 +1474,7 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - acquire_lease.metadata = {"url": "{url}/{containerName}/{blob}"} + acquire_lease.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def release_lease( # pylint: disable=inconsistent-return-statements @@ -1573,20 +1512,15 @@ async def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -1618,9 +1552,9 @@ async def release_lease( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1644,7 +1578,7 @@ async def release_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - release_lease.metadata = {"url": "{url}/{containerName}/{blob}"} + release_lease.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def renew_lease( # pylint: disable=inconsistent-return-statements @@ -1682,20 +1616,15 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -1727,9 +1656,9 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1754,7 +1683,7 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - renew_lease.metadata = {"url": "{url}/{containerName}/{blob}"} + renew_lease.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def change_lease( # pylint: disable=inconsistent-return-statements @@ -1797,20 +1726,15 @@ async def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -1843,9 +1767,9 @@ async def change_lease( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1870,7 +1794,7 @@ async def change_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - change_lease.metadata = {"url": "{url}/{containerName}/{blob}"} + change_lease.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def break_lease( # pylint: disable=inconsistent-return-statements @@ -1914,20 +1838,15 @@ async def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -1959,9 +1878,9 @@ async def break_lease( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1986,7 +1905,7 @@ async def break_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - break_lease.metadata = {"url": "{url}/{containerName}/{blob}"} + break_lease.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def create_snapshot( # pylint: disable=inconsistent-return-statements @@ -2035,19 +1954,14 @@ async def create_snapshot( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["snapshot"] = kwargs.pop("comp", _params.pop("comp", "snapshot")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "snapshot")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _encryption_key = None _encryption_key_sha256 = None @@ -2096,9 +2010,9 @@ async def create_snapshot( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2127,7 +2041,7 @@ async def create_snapshot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - create_snapshot.metadata = {"url": "{url}/{containerName}/{blob}"} + create_snapshot.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def start_copy_from_url( # pylint: disable=inconsistent-return-statements @@ -2135,13 +2049,13 @@ async def start_copy_from_url( # pylint: disable=inconsistent-return-statements copy_source: str, timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, _models.AccessTierOptional]] = None, - rehydrate_priority: Optional[Union[str, _models.RehydratePriority]] = None, + tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, + rehydrate_priority: Optional[Union[str, "_models.RehydratePriority"]] = None, request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, seal_blob: Optional[bool] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, + immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, legal_hold: Optional[bool] = None, source_modified_access_conditions: Optional[_models.SourceModifiedAccessConditions] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, @@ -2205,18 +2119,13 @@ async def start_copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls = kwargs.pop("cls", None) # type: ClsType[None] _source_if_modified_since = None _source_if_unmodified_since = None @@ -2274,9 +2183,9 @@ async def start_copy_from_url( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2303,7 +2212,7 @@ async def start_copy_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - start_copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} + start_copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def copy_from_url( # pylint: disable=inconsistent-return-statements @@ -2311,15 +2220,15 @@ async def copy_from_url( # pylint: disable=inconsistent-return-statements copy_source: str, timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, _models.AccessTierOptional]] = None, + tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, request_id_parameter: Optional[str] = None, source_content_md5: Optional[bytes] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, + immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, legal_hold: Optional[bool] = None, copy_source_authorization: Optional[str] = None, - copy_source_tags: Optional[Union[str, _models.BlobCopySourceTags]] = None, + copy_source_tags: Optional[Union[str, "_models.BlobCopySourceTags"]] = None, source_modified_access_conditions: Optional[_models.SourceModifiedAccessConditions] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -2394,21 +2303,14 @@ async def copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - x_ms_requires_sync: Literal["true"] = kwargs.pop( - "x_ms_requires_sync", _headers.pop("x-ms-requires-sync", "true") - ) - cls: ClsType[None] = kwargs.pop("cls", None) + x_ms_requires_sync = kwargs.pop("x_ms_requires_sync", _headers.pop("x-ms-requires-sync", "true")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _source_if_modified_since = None _source_if_unmodified_since = None @@ -2469,9 +2371,9 @@ async def copy_from_url( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2505,7 +2407,7 @@ async def copy_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} + copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def abort_copy_from_url( # pylint: disable=inconsistent-return-statements @@ -2544,22 +2446,17 @@ async def abort_copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["copy"] = kwargs.pop("comp", _params.pop("comp", "copy")) - copy_action_abort_constant: Literal["abort"] = kwargs.pop( + comp = kwargs.pop("comp", _params.pop("comp", "copy")) # type: str + copy_action_abort_constant = kwargs.pop( "copy_action_abort_constant", _headers.pop("x-ms-copy-action", "abort") - ) - cls: ClsType[None] = kwargs.pop("cls", None) + ) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None if lease_access_conditions is not None: @@ -2579,9 +2476,9 @@ async def abort_copy_from_url( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2603,16 +2500,16 @@ async def abort_copy_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - abort_copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} + abort_copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def set_tier( # pylint: disable=inconsistent-return-statements self, - tier: Union[str, _models.AccessTierRequired], + tier: Union[str, "_models.AccessTierRequired"], snapshot: Optional[str] = None, version_id: Optional[str] = None, timeout: Optional[int] = None, - rehydrate_priority: Optional[Union[str, _models.RehydratePriority]] = None, + rehydrate_priority: Optional[Union[str, "_models.RehydratePriority"]] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, @@ -2662,19 +2559,14 @@ async def set_tier( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["tier"] = kwargs.pop("comp", _params.pop("comp", "tier")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "tier")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _if_tags = None @@ -2700,9 +2592,9 @@ async def set_tier( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2731,7 +2623,7 @@ async def set_tier( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_tier.metadata = {"url": "{url}/{containerName}/{blob}"} + set_tier.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -2748,20 +2640,15 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account")) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "account")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_get_account_info_request( url=self._config.url, @@ -2773,9 +2660,9 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2799,7 +2686,7 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco if cls: return cls(pipeline_response, None, response_headers) - get_account_info.metadata = {"url": "{url}/{containerName}/{blob}"} + get_account_info.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def query( @@ -2847,20 +2734,15 @@ async def query( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["query"] = kwargs.pop("comp", _params.pop("comp", "query")) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "query")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[AsyncIterator[bytes]] _lease_id = None _encryption_key = None @@ -2911,9 +2793,9 @@ async def query( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=True, **kwargs ) @@ -3049,11 +2931,11 @@ async def query( deserialized = response.stream_download(self._client._pipeline) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) - return deserialized # type: ignore + return deserialized - query.metadata = {"url": "{url}/{containerName}/{blob}"} + query.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def get_tags( @@ -3099,19 +2981,14 @@ async def get_tags( :rtype: ~azure.storage.blob.models.BlobTags :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["tags"] = kwargs.pop("comp", _params.pop("comp", "tags")) - cls: ClsType[_models.BlobTags] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "tags")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BlobTags] _if_tags = None _lease_id = None @@ -3135,9 +3012,9 @@ async def get_tags( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3163,7 +3040,7 @@ async def get_tags( return deserialized - get_tags.metadata = {"url": "{url}/{containerName}/{blob}"} + get_tags.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def set_tags( # pylint: disable=inconsistent-return-statements @@ -3213,20 +3090,15 @@ async def set_tags( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["tags"] = kwargs.pop("comp", _params.pop("comp", "tags")) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "tags")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_tags = None _lease_id = None @@ -3257,9 +3129,9 @@ async def set_tags( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3281,4 +3153,4 @@ async def set_tags( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_tags.metadata = {"url": "{url}/{containerName}/{blob}"} + set_tags.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py index ef347a461baf..b3ac51917d51 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py @@ -7,7 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -15,7 +14,6 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, - ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -35,10 +33,6 @@ build_upload_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,11 +64,11 @@ async def upload( # pylint: disable=inconsistent-return-statements timeout: Optional[int] = None, transactional_content_md5: Optional[bytes] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, _models.AccessTierOptional]] = None, + tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, + immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, legal_hold: Optional[bool] = None, transactional_content_crc64: Optional[bytes] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, @@ -151,20 +145,15 @@ async def upload( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - blob_type: Literal["BlockBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) - cls: ClsType[None] = kwargs.pop("cls", None) + blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _blob_content_type = None _blob_content_encoding = None @@ -243,9 +232,9 @@ async def upload( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -280,7 +269,7 @@ async def upload( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - upload.metadata = {"url": "{url}/{containerName}/{blob}"} + upload.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def put_blob_from_url( # pylint: disable=inconsistent-return-statements @@ -290,13 +279,13 @@ async def put_blob_from_url( # pylint: disable=inconsistent-return-statements timeout: Optional[int] = None, transactional_content_md5: Optional[bytes] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, _models.AccessTierOptional]] = None, + tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, request_id_parameter: Optional[str] = None, source_content_md5: Optional[bytes] = None, blob_tags_string: Optional[str] = None, copy_source_blob_properties: Optional[bool] = None, copy_source_authorization: Optional[str] = None, - copy_source_tags: Optional[Union[str, _models.BlobCopySourceTags]] = None, + copy_source_tags: Optional[Union[str, "_models.BlobCopySourceTags"]] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, cpk_info: Optional[_models.CpkInfo] = None, @@ -380,19 +369,14 @@ async def put_blob_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - blob_type: Literal["BlockBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) - cls: ClsType[None] = kwargs.pop("cls", None) + blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _blob_content_type = None _blob_content_encoding = None @@ -485,9 +469,9 @@ async def put_blob_from_url( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -522,7 +506,7 @@ async def put_blob_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - put_blob_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} + put_blob_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def stage_block( # pylint: disable=inconsistent-return-statements @@ -578,20 +562,15 @@ async def stage_block( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["block"] = kwargs.pop("comp", _params.pop("comp", "block")) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "block")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _encryption_key = None @@ -630,9 +609,9 @@ async def stage_block( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -667,7 +646,7 @@ async def stage_block( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - stage_block.metadata = {"url": "{url}/{containerName}/{blob}"} + stage_block.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def stage_block_from_url( # pylint: disable=inconsistent-return-statements @@ -735,19 +714,14 @@ async def stage_block_from_url( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["block"] = kwargs.pop("comp", _params.pop("comp", "block")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "block")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _encryption_key = None _encryption_key_sha256 = None @@ -799,9 +773,9 @@ async def stage_block_from_url( # pylint: disable=inconsistent-return-statement params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -836,7 +810,7 @@ async def stage_block_from_url( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, response_headers) - stage_block_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} + stage_block_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def commit_block_list( # pylint: disable=inconsistent-return-statements @@ -846,11 +820,11 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements transactional_content_md5: Optional[bytes] = None, transactional_content_crc64: Optional[bytes] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, _models.AccessTierOptional]] = None, + tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, + immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, legal_hold: Optional[bool] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -925,20 +899,15 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["blocklist"] = kwargs.pop("comp", _params.pop("comp", "blocklist")) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "blocklist")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _blob_cache_control = None _blob_content_type = None @@ -1016,9 +985,9 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1056,13 +1025,13 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - commit_block_list.metadata = {"url": "{url}/{containerName}/{blob}"} + commit_block_list.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def get_block_list( self, snapshot: Optional[str] = None, - list_type: Union[str, _models.BlockListType] = "committed", + list_type: Union[str, "_models.BlockListType"] = "committed", timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -1103,19 +1072,14 @@ async def get_block_list( :rtype: ~azure.storage.blob.models.BlockList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["blocklist"] = kwargs.pop("comp", _params.pop("comp", "blocklist")) - cls: ClsType[_models.BlockList] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "blocklist")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BlockList] _lease_id = None _if_tags = None @@ -1139,9 +1103,9 @@ async def get_block_list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1173,4 +1137,4 @@ async def get_block_list( return deserialized - get_block_list.metadata = {"url": "{url}/{containerName}/{blob}"} + get_block_list.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py index 5866a72c6622..6326516ba7f8 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -14,7 +13,6 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, - ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -46,10 +44,6 @@ build_submit_batch_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +72,7 @@ async def create( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, - access: Optional[Union[str, _models.PublicAccessType]] = None, + access: Optional[Union[str, "_models.PublicAccessType"]] = None, request_id_parameter: Optional[str] = None, container_cpk_scope_info: Optional[_models.ContainerCpkScopeInfo] = None, **kwargs: Any @@ -116,19 +110,14 @@ async def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _default_encryption_scope = None _prevent_encryption_scope_override = None @@ -151,9 +140,9 @@ async def create( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -177,7 +166,7 @@ async def create( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {"url": "{url}/{containerName}"} + create.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace_async async def get_properties( # pylint: disable=inconsistent-return-statements @@ -209,19 +198,14 @@ async def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None if lease_access_conditions is not None: @@ -239,9 +223,9 @@ async def get_properties( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -285,7 +269,7 @@ async def get_properties( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {"url": "{url}/{containerName}"} + get_properties.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -320,19 +304,14 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _if_modified_since = None @@ -357,9 +336,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -381,7 +360,7 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {"url": "{url}/{containerName}"} + delete.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace_async async def set_metadata( # pylint: disable=inconsistent-return-statements @@ -427,20 +406,15 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "metadata")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _if_modified_since = None @@ -464,9 +438,9 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -490,7 +464,7 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_metadata.metadata = {"url": "{url}/{containerName}"} + set_metadata.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace_async async def get_access_policy( @@ -525,20 +499,15 @@ async def get_access_policy( :rtype: list[~azure.storage.blob.models.SignedIdentifier] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["acl"] = kwargs.pop("comp", _params.pop("comp", "acl")) - cls: ClsType[List[_models.SignedIdentifier]] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "acl")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[List[_models.SignedIdentifier]] _lease_id = None if lease_access_conditions is not None: @@ -557,9 +526,9 @@ async def get_access_policy( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -590,13 +559,13 @@ async def get_access_policy( return deserialized - get_access_policy.metadata = {"url": "{url}/{containerName}"} + get_access_policy.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace_async async def set_access_policy( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, - access: Optional[Union[str, _models.PublicAccessType]] = None, + access: Optional[Union[str, "_models.PublicAccessType"]] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, @@ -635,21 +604,16 @@ async def set_access_policy( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["acl"] = kwargs.pop("comp", _params.pop("comp", "acl")) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "acl")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _if_modified_since = None @@ -685,9 +649,9 @@ async def set_access_policy( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -711,7 +675,7 @@ async def set_access_policy( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_access_policy.metadata = {"url": "{url}/{containerName}"} + set_access_policy.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace_async async def restore( # pylint: disable=inconsistent-return-statements @@ -750,20 +714,15 @@ async def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["undelete"] = kwargs.pop("comp", _params.pop("comp", "undelete")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "undelete")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_restore_request( url=self._config.url, @@ -779,9 +738,9 @@ async def restore( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -803,7 +762,7 @@ async def restore( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - restore.metadata = {"url": "{url}/{containerName}"} + restore.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace_async async def rename( # pylint: disable=inconsistent-return-statements @@ -842,20 +801,15 @@ async def rename( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["rename"] = kwargs.pop("comp", _params.pop("comp", "rename")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "rename")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_rename_request( url=self._config.url, @@ -871,9 +825,9 @@ async def rename( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -895,7 +849,7 @@ async def rename( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - rename.metadata = {"url": "{url}/{containerName}"} + rename.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace_async async def submit_batch( @@ -932,23 +886,18 @@ async def submit_batch( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["batch"] = kwargs.pop("comp", _params.pop("comp", "batch")) - multipart_content_type: str = kwargs.pop( + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "batch")) # type: str + multipart_content_type = kwargs.pop( "multipart_content_type", _headers.pop("Content-Type", "application/xml") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + ) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[AsyncIterator[bytes]] _content = body @@ -967,9 +916,9 @@ async def submit_batch( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=True, **kwargs ) @@ -988,11 +937,11 @@ async def submit_batch( deserialized = response.stream_download(self._client._pipeline) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) - return deserialized # type: ignore + return deserialized - submit_batch.metadata = {"url": "{url}/{containerName}"} + submit_batch.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace_async async def filter_blobs( @@ -1002,7 +951,7 @@ async def filter_blobs( where: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, _models.FilterBlobsIncludeItem]]] = None, + include: Optional[List[Union[str, "_models.FilterBlobsIncludeItem"]]] = None, **kwargs: Any ) -> _models.FilterBlobSegment: """The Filter Blobs operation enables callers to list blobs in a container whose tags match a @@ -1048,20 +997,15 @@ async def filter_blobs( :rtype: ~azure.storage.blob.models.FilterBlobSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["blobs"] = kwargs.pop("comp", _params.pop("comp", "blobs")) - cls: ClsType[_models.FilterBlobSegment] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "blobs")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.FilterBlobSegment] request = build_filter_blobs_request( url=self._config.url, @@ -1079,9 +1023,9 @@ async def filter_blobs( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1107,7 +1051,7 @@ async def filter_blobs( return deserialized - filter_blobs.metadata = {"url": "{url}/{containerName}"} + filter_blobs.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace_async async def acquire_lease( # pylint: disable=inconsistent-return-statements @@ -1155,21 +1099,16 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -1194,9 +1133,9 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1221,7 +1160,7 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - acquire_lease.metadata = {"url": "{url}/{containerName}"} + acquire_lease.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace_async async def release_lease( # pylint: disable=inconsistent-return-statements @@ -1262,21 +1201,16 @@ async def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -1300,9 +1234,9 @@ async def release_lease( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1326,7 +1260,7 @@ async def release_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - release_lease.metadata = {"url": "{url}/{containerName}"} + release_lease.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace_async async def renew_lease( # pylint: disable=inconsistent-return-statements @@ -1367,21 +1301,16 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -1405,9 +1334,9 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1432,7 +1361,7 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - renew_lease.metadata = {"url": "{url}/{containerName}"} + renew_lease.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace_async async def break_lease( # pylint: disable=inconsistent-return-statements @@ -1479,21 +1408,16 @@ async def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -1517,9 +1441,9 @@ async def break_lease( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1544,7 +1468,7 @@ async def break_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - break_lease.metadata = {"url": "{url}/{containerName}"} + break_lease.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace_async async def change_lease( # pylint: disable=inconsistent-return-statements @@ -1590,21 +1514,16 @@ async def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -1629,9 +1548,9 @@ async def change_lease( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1656,7 +1575,7 @@ async def change_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - change_lease.metadata = {"url": "{url}/{containerName}"} + change_lease.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace_async async def list_blob_flat_segment( @@ -1664,7 +1583,7 @@ async def list_blob_flat_segment( prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, _models.ListBlobsIncludeItem]]] = None, + include: Optional[List[Union[str, "_models.ListBlobsIncludeItem"]]] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any @@ -1711,20 +1630,15 @@ async def list_blob_flat_segment( :rtype: ~azure.storage.blob.models.ListBlobsFlatSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) - cls: ClsType[_models.ListBlobsFlatSegmentResponse] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "list")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ListBlobsFlatSegmentResponse] request = build_list_blob_flat_segment_request( url=self._config.url, @@ -1742,9 +1656,9 @@ async def list_blob_flat_segment( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1771,7 +1685,7 @@ async def list_blob_flat_segment( return deserialized - list_blob_flat_segment.metadata = {"url": "{url}/{containerName}"} + list_blob_flat_segment.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace_async async def list_blob_hierarchy_segment( @@ -1780,7 +1694,7 @@ async def list_blob_hierarchy_segment( prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, _models.ListBlobsIncludeItem]]] = None, + include: Optional[List[Union[str, "_models.ListBlobsIncludeItem"]]] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any @@ -1832,20 +1746,15 @@ async def list_blob_hierarchy_segment( :rtype: ~azure.storage.blob.models.ListBlobsHierarchySegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) - cls: ClsType[_models.ListBlobsHierarchySegmentResponse] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "list")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ListBlobsHierarchySegmentResponse] request = build_list_blob_hierarchy_segment_request( url=self._config.url, @@ -1864,9 +1773,9 @@ async def list_blob_hierarchy_segment( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1893,7 +1802,7 @@ async def list_blob_hierarchy_segment( return deserialized - list_blob_hierarchy_segment.metadata = {"url": "{url}/{containerName}"} + list_blob_hierarchy_segment.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace_async async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -1910,20 +1819,15 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account")) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "account")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_get_account_info_request( url=self._config.url, @@ -1935,9 +1839,9 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1961,4 +1865,4 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco if cls: return cls(pipeline_response, None, response_headers) - get_account_info.metadata = {"url": "{url}/{containerName}"} + get_account_info.metadata = {"url": "{url}/{containerName}"} # type: ignore diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py index dee8c287bc53..2ef6ac25985d 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py @@ -7,7 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -15,7 +14,6 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, - ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -38,10 +36,6 @@ build_upload_pages_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,13 +65,13 @@ async def create( # pylint: disable=inconsistent-return-statements content_length: int, blob_content_length: int, timeout: Optional[int] = None, - tier: Optional[Union[str, _models.PremiumPageBlobAccessTier]] = None, + tier: Optional[Union[str, "_models.PremiumPageBlobAccessTier"]] = None, metadata: Optional[Dict[str, str]] = None, blob_sequence_number: int = 0, request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, + immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, legal_hold: Optional[bool] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -147,19 +141,14 @@ async def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - blob_type: Literal["PageBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "PageBlob")) - cls: ClsType[None] = kwargs.pop("cls", None) + blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "PageBlob")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _blob_content_type = None _blob_content_encoding = None @@ -235,9 +224,9 @@ async def create( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -272,7 +261,7 @@ async def create( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {"url": "{url}/{containerName}/{blob}"} + create.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def upload_pages( # pylint: disable=inconsistent-return-statements @@ -343,21 +332,16 @@ async def upload_pages( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page")) - page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "page")) # type: str + page_write = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _encryption_key = None @@ -425,9 +409,9 @@ async def upload_pages( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -467,7 +451,7 @@ async def upload_pages( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - upload_pages.metadata = {"url": "{url}/{containerName}/{blob}"} + upload_pages.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def clear_pages( # pylint: disable=inconsistent-return-statements @@ -527,20 +511,15 @@ async def clear_pages( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page")) - page_write: Literal["clear"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "clear")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "page")) # type: str + page_write = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "clear")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _encryption_key = None @@ -603,9 +582,9 @@ async def clear_pages( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -636,7 +615,7 @@ async def clear_pages( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - clear_pages.metadata = {"url": "{url}/{containerName}/{blob}"} + clear_pages.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def upload_pages_from_url( # pylint: disable=inconsistent-return-statements @@ -721,20 +700,15 @@ async def upload_pages_from_url( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page")) - page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "page")) # type: str + page_write = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _encryption_key = None _encryption_key_sha256 = None @@ -815,9 +789,9 @@ async def upload_pages_from_url( # pylint: disable=inconsistent-return-statemen params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -854,7 +828,7 @@ async def upload_pages_from_url( # pylint: disable=inconsistent-return-statemen if cls: return cls(pipeline_response, None, response_headers) - upload_pages_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} + upload_pages_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def get_page_ranges( @@ -915,19 +889,14 @@ async def get_page_ranges( :rtype: ~azure.storage.blob.models.PageList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["pagelist"] = kwargs.pop("comp", _params.pop("comp", "pagelist")) - cls: ClsType[_models.PageList] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "pagelist")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PageList] _lease_id = None _if_modified_since = None @@ -965,9 +934,9 @@ async def get_page_ranges( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -998,7 +967,7 @@ async def get_page_ranges( return deserialized - get_page_ranges.metadata = {"url": "{url}/{containerName}/{blob}"} + get_page_ranges.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def get_page_ranges_diff( @@ -1073,19 +1042,14 @@ async def get_page_ranges_diff( :rtype: ~azure.storage.blob.models.PageList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["pagelist"] = kwargs.pop("comp", _params.pop("comp", "pagelist")) - cls: ClsType[_models.PageList] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "pagelist")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PageList] _lease_id = None _if_modified_since = None @@ -1125,9 +1089,9 @@ async def get_page_ranges_diff( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1158,7 +1122,7 @@ async def get_page_ranges_diff( return deserialized - get_page_ranges_diff.metadata = {"url": "{url}/{containerName}/{blob}"} + get_page_ranges_diff.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def resize( # pylint: disable=inconsistent-return-statements @@ -1202,19 +1166,14 @@ async def resize( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _encryption_key = None @@ -1263,9 +1222,9 @@ async def resize( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1292,12 +1251,12 @@ async def resize( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - resize.metadata = {"url": "{url}/{containerName}/{blob}"} + resize.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def update_sequence_number( # pylint: disable=inconsistent-return-statements self, - sequence_number_action: Union[str, _models.SequenceNumberActionType], + sequence_number_action: Union[str, "_models.SequenceNumberActionType"], timeout: Optional[int] = None, blob_sequence_number: int = 0, request_id_parameter: Optional[str] = None, @@ -1337,19 +1296,14 @@ async def update_sequence_number( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _if_modified_since = None @@ -1385,9 +1339,9 @@ async def update_sequence_number( # pylint: disable=inconsistent-return-stateme params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1414,7 +1368,7 @@ async def update_sequence_number( # pylint: disable=inconsistent-return-stateme if cls: return cls(pipeline_response, None, response_headers) - update_sequence_number.metadata = {"url": "{url}/{containerName}/{blob}"} + update_sequence_number.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace_async async def copy_incremental( # pylint: disable=inconsistent-return-statements @@ -1455,19 +1409,14 @@ async def copy_incremental( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["incrementalcopy"] = kwargs.pop("comp", _params.pop("comp", "incrementalcopy")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "incrementalcopy")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -1498,9 +1447,9 @@ async def copy_incremental( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1526,4 +1475,4 @@ async def copy_incremental( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - copy_incremental.metadata = {"url": "{url}/{containerName}/{blob}"} + copy_incremental.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py index 2e5c4f79cdeb..fd98fdac1f30 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -14,7 +13,6 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, - ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -36,10 +34,6 @@ build_submit_batch_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -96,21 +90,16 @@ async def set_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _content = self._serialize.body(storage_service_properties, "StorageServiceProperties", is_xml=True) @@ -128,9 +117,9 @@ async def set_properties( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -151,7 +140,7 @@ async def set_properties( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_properties.metadata = {"url": "{url}"} + set_properties.metadata = {"url": "{url}"} # type: ignore @distributed_trace_async async def get_properties( @@ -180,20 +169,15 @@ async def get_properties( :rtype: ~azure.storage.blob.models.StorageServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - cls: ClsType[_models.StorageServiceProperties] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageServiceProperties] request = build_get_properties_request( url=self._config.url, @@ -207,9 +191,9 @@ async def get_properties( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -234,7 +218,7 @@ async def get_properties( return deserialized - get_properties.metadata = {"url": "{url}"} + get_properties.metadata = {"url": "{url}"} # type: ignore @distributed_trace_async async def get_statistics( @@ -264,20 +248,15 @@ async def get_statistics( :rtype: ~azure.storage.blob.models.StorageServiceStats :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) - comp: Literal["stats"] = kwargs.pop("comp", _params.pop("comp", "stats")) - cls: ClsType[_models.StorageServiceStats] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "stats")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageServiceStats] request = build_get_statistics_request( url=self._config.url, @@ -291,9 +270,9 @@ async def get_statistics( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -319,7 +298,7 @@ async def get_statistics( return deserialized - get_statistics.metadata = {"url": "{url}"} + get_statistics.metadata = {"url": "{url}"} # type: ignore @distributed_trace_async async def list_containers_segment( @@ -327,7 +306,7 @@ async def list_containers_segment( prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, _models.ListContainersIncludeType]]] = None, + include: Optional[List[Union[str, "_models.ListContainersIncludeType"]]] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any @@ -372,19 +351,14 @@ async def list_containers_segment( :rtype: ~azure.storage.blob.models.ListContainersSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) - cls: ClsType[_models.ListContainersSegmentResponse] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "list")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ListContainersSegmentResponse] request = build_list_containers_segment_request( url=self._config.url, @@ -401,9 +375,9 @@ async def list_containers_segment( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -428,7 +402,7 @@ async def list_containers_segment( return deserialized - list_containers_segment.metadata = {"url": "{url}"} + list_containers_segment.metadata = {"url": "{url}"} # type: ignore @distributed_trace_async async def get_user_delegation_key( @@ -463,21 +437,16 @@ async def get_user_delegation_key( :rtype: ~azure.storage.blob.models.UserDelegationKey :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) - comp: Literal["userdelegationkey"] = kwargs.pop("comp", _params.pop("comp", "userdelegationkey")) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) - cls: ClsType[_models.UserDelegationKey] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "userdelegationkey")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.UserDelegationKey] _content = self._serialize.body(key_info, "KeyInfo", is_xml=True) @@ -495,9 +464,9 @@ async def get_user_delegation_key( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -523,7 +492,7 @@ async def get_user_delegation_key( return deserialized - get_user_delegation_key.metadata = {"url": "{url}"} + get_user_delegation_key.metadata = {"url": "{url}"} # type: ignore @distributed_trace_async async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -540,20 +509,15 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account")) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "account")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_get_account_info_request( url=self._config.url, @@ -565,9 +529,9 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -592,7 +556,7 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco if cls: return cls(pipeline_response, None, response_headers) - get_account_info.metadata = {"url": "{url}"} + get_account_info.metadata = {"url": "{url}"} # type: ignore @distributed_trace_async async def submit_batch( @@ -626,22 +590,17 @@ async def submit_batch( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["batch"] = kwargs.pop("comp", _params.pop("comp", "batch")) - multipart_content_type: str = kwargs.pop( + comp = kwargs.pop("comp", _params.pop("comp", "batch")) # type: str + multipart_content_type = kwargs.pop( "multipart_content_type", _headers.pop("Content-Type", "application/xml") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + ) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[AsyncIterator[bytes]] _content = body @@ -659,9 +618,9 @@ async def submit_batch( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=True, **kwargs ) @@ -680,11 +639,11 @@ async def submit_batch( deserialized = response.stream_download(self._client._pipeline) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) - return deserialized # type: ignore + return deserialized - submit_batch.metadata = {"url": "{url}"} + submit_batch.metadata = {"url": "{url}"} # type: ignore @distributed_trace_async async def filter_blobs( @@ -694,7 +653,7 @@ async def filter_blobs( where: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, _models.FilterBlobsIncludeItem]]] = None, + include: Optional[List[Union[str, "_models.FilterBlobsIncludeItem"]]] = None, **kwargs: Any ) -> _models.FilterBlobSegment: """The Filter Blobs operation enables callers to list blobs across all containers whose tags match @@ -738,19 +697,14 @@ async def filter_blobs( :rtype: ~azure.storage.blob.models.FilterBlobSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["blobs"] = kwargs.pop("comp", _params.pop("comp", "blobs")) - cls: ClsType[_models.FilterBlobSegment] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "blobs")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.FilterBlobSegment] request = build_filter_blobs_request( url=self._config.url, @@ -767,9 +721,9 @@ async def filter_blobs( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -795,4 +749,4 @@ async def filter_blobs( return deserialized - filter_blobs.metadata = {"url": "{url}"} + filter_blobs.metadata = {"url": "{url}"} # type: ignore diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/__init__.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/__init__.py index 63ca7e23fc24..ffa0865eed47 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/__init__.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/__init__.py @@ -86,7 +86,7 @@ from ._azure_blob_storage_enums import SkuName from ._azure_blob_storage_enums import StorageErrorCode from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py index cdc978a49f17..21f534a9a521 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py @@ -13,14 +13,13 @@ from .. import _serialization +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -42,13 +41,8 @@ class AccessPolicy(_serialization.Model): } def __init__( - self, - *, - start: Optional[str] = None, - expiry: Optional[str] = None, - permission: Optional[str] = None, - **kwargs: Any - ) -> None: + self, *, start: Optional[str] = None, expiry: Optional[str] = None, permission: Optional[str] = None, **kwargs + ): """ :keyword start: the date-time the policy is active. :paramtype start: str @@ -83,7 +77,7 @@ class AppendPositionAccessConditions(_serialization.Model): "append_position": {"key": "appendPosition", "type": "int"}, } - def __init__(self, *, max_size: Optional[int] = None, append_position: Optional[int] = None, **kwargs: Any) -> None: + def __init__(self, *, max_size: Optional[int] = None, append_position: Optional[int] = None, **kwargs): """ :keyword max_size: Optional conditional header. The max length in bytes permitted for the append blob. If the Append Block operation would cause the blob to exceed that limit or if the @@ -123,7 +117,7 @@ class ArrowConfiguration(_serialization.Model): } _xml_map = {"name": "ArrowConfiguration"} - def __init__(self, *, schema: List["_models.ArrowField"], **kwargs: Any) -> None: + def __init__(self, *, schema: List["_models.ArrowField"], **kwargs): """ :keyword schema: Required. :paramtype schema: list[~azure.storage.blob.models.ArrowField] @@ -166,8 +160,8 @@ def __init__( name: Optional[str] = None, precision: Optional[int] = None, scale: Optional[int] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword type: Required. :paramtype type: str @@ -203,7 +197,7 @@ class BlobFlatListSegment(_serialization.Model): } _xml_map = {"name": "Blobs"} - def __init__(self, *, blob_items: List["_models.BlobItemInternal"], **kwargs: Any) -> None: + def __init__(self, *, blob_items: List["_models.BlobItemInternal"], **kwargs): """ :keyword blob_items: Required. :paramtype blob_items: list[~azure.storage.blob.models.BlobItemInternal] @@ -238,8 +232,8 @@ def __init__( *, blob_items: List["_models.BlobItemInternal"], blob_prefixes: Optional[List["_models.BlobPrefix"]] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword blob_prefixes: :paramtype blob_prefixes: list[~azure.storage.blob.models.BlobPrefix] @@ -291,8 +285,8 @@ def __init__( blob_content_encoding: Optional[str] = None, blob_content_language: Optional[str] = None, blob_content_disposition: Optional[str] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword blob_cache_control: Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read request. @@ -382,8 +376,8 @@ def __init__( blob_tags: Optional["_models.BlobTags"] = None, has_versions_only: Optional[bool] = None, object_replication_metadata: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword name: Required. :paramtype name: ~azure.storage.blob.models.BlobName @@ -436,8 +430,8 @@ class BlobMetadata(_serialization.Model): _xml_map = {"name": "Metadata"} def __init__( - self, *, additional_properties: Optional[Dict[str, str]] = None, encrypted: Optional[str] = None, **kwargs: Any - ) -> None: + self, *, additional_properties: Optional[Dict[str, str]] = None, encrypted: Optional[str] = None, **kwargs + ): """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -464,7 +458,7 @@ class BlobName(_serialization.Model): "content": {"key": "content", "type": "str", "xml": {"text": True}}, } - def __init__(self, *, encoded: Optional[bool] = None, content: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, encoded: Optional[bool] = None, content: Optional[str] = None, **kwargs): """ :keyword encoded: Indicates if the blob name is encoded. :paramtype encoded: bool @@ -493,7 +487,7 @@ class BlobPrefix(_serialization.Model): "name": {"key": "Name", "type": "BlobName"}, } - def __init__(self, *, name: "_models.BlobName", **kwargs: Any) -> None: + def __init__(self, *, name: "_models.BlobName", **kwargs): """ :keyword name: Required. :paramtype name: ~azure.storage.blob.models.BlobName @@ -686,8 +680,8 @@ def __init__( # pylint: disable=too-many-locals immutability_policy_expires_on: Optional[datetime.datetime] = None, immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, legal_hold: Optional[bool] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword creation_time: :paramtype creation_time: ~datetime.datetime @@ -841,7 +835,7 @@ class BlobTag(_serialization.Model): } _xml_map = {"name": "Tag"} - def __init__(self, *, key: str, value: str, **kwargs: Any) -> None: + def __init__(self, *, key: str, value: str, **kwargs): """ :keyword key: Required. :paramtype key: str @@ -875,7 +869,7 @@ class BlobTags(_serialization.Model): } _xml_map = {"name": "Tags"} - def __init__(self, *, blob_tag_set: List["_models.BlobTag"], **kwargs: Any) -> None: + def __init__(self, *, blob_tag_set: List["_models.BlobTag"], **kwargs): """ :keyword blob_tag_set: Required. :paramtype blob_tag_set: list[~azure.storage.blob.models.BlobTag] @@ -905,7 +899,7 @@ class Block(_serialization.Model): "size": {"key": "Size", "type": "int"}, } - def __init__(self, *, name: str, size: int, **kwargs: Any) -> None: + def __init__(self, *, name: str, size: int, **kwargs): """ :keyword name: The base64 encoded block ID. Required. :paramtype name: str @@ -936,8 +930,8 @@ def __init__( *, committed_blocks: Optional[List["_models.Block"]] = None, uncommitted_blocks: Optional[List["_models.Block"]] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword committed_blocks: :paramtype committed_blocks: list[~azure.storage.blob.models.Block] @@ -973,8 +967,8 @@ def __init__( committed: Optional[List[str]] = None, uncommitted: Optional[List[str]] = None, latest: Optional[List[str]] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword committed: :paramtype committed: list[str] @@ -1011,7 +1005,7 @@ class ClearRange(_serialization.Model): } _xml_map = {"name": "ClearRange"} - def __init__(self, *, start: int, end: int, **kwargs: Any) -> None: + def __init__(self, *, start: int, end: int, **kwargs): """ :keyword start: Required. :paramtype start: int @@ -1045,8 +1039,8 @@ def __init__( *, default_encryption_scope: Optional[str] = None, prevent_encryption_scope_override: Optional[bool] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword default_encryption_scope: Optional. Version 2019-07-07 and later. Specifies the default encryption scope to set on the container and use for all future writes. @@ -1100,8 +1094,8 @@ def __init__( deleted: Optional[bool] = None, version: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword name: Required. :paramtype name: str @@ -1197,8 +1191,8 @@ def __init__( deleted_time: Optional[datetime.datetime] = None, remaining_retention_days: Optional[int] = None, is_immutable_storage_with_versioning_enabled: Optional[bool] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword last_modified: Required. :paramtype last_modified: ~datetime.datetime @@ -1246,10 +1240,7 @@ def __init__( class CorsRule(_serialization.Model): - """CORS is an HTTP feature that enables a web application running under one domain to access - resources in another domain. Web browsers implement a security restriction known as same-origin - policy that prevents a web page from calling APIs in a different domain; CORS provides a secure - way to allow one domain (the origin domain) to call APIs in another domain. + """CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain. All required parameters must be populated in order to send to Azure. @@ -1297,8 +1288,8 @@ def __init__( allowed_headers: str, exposed_headers: str, max_age_in_seconds: int, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword allowed_origins: The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request originates. @@ -1355,8 +1346,8 @@ def __init__( encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword encryption_key: Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account @@ -1390,7 +1381,7 @@ class CpkScopeInfo(_serialization.Model): "encryption_scope": {"key": "encryptionScope", "type": "str"}, } - def __init__(self, *, encryption_scope: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, encryption_scope: Optional[str] = None, **kwargs): """ :keyword encryption_scope: Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, @@ -1403,8 +1394,7 @@ def __init__(self, *, encryption_scope: Optional[str] = None, **kwargs: Any) -> class DelimitedTextConfiguration(_serialization.Model): - """Groups the settings used for interpreting the blob data if the blob is delimited text - formatted. + """Groups the settings used for interpreting the blob data if the blob is delimited text formatted. :ivar column_separator: The string used to separate columns. :vartype column_separator: str @@ -1435,8 +1425,8 @@ def __init__( record_separator: Optional[str] = None, escape_char: Optional[str] = None, headers_present: Optional[bool] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword column_separator: The string used to separate columns. :paramtype column_separator: str @@ -1496,8 +1486,8 @@ def __init__( tags: Optional["_models.BlobTags"] = None, version_id: Optional[str] = None, is_current_version: Optional[bool] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword name: Required. :paramtype name: str @@ -1558,8 +1548,8 @@ def __init__( where: str, blobs: List["_models.FilterBlobItem"], next_marker: Optional[str] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword service_endpoint: Required. :paramtype service_endpoint: str @@ -1602,12 +1592,8 @@ class GeoReplication(_serialization.Model): } def __init__( - self, - *, - status: Union[str, "_models.GeoReplicationStatusType"], - last_sync_time: datetime.datetime, - **kwargs: Any - ) -> None: + self, *, status: Union[str, "_models.GeoReplicationStatusType"], last_sync_time: datetime.datetime, **kwargs + ): """ :keyword status: The status of the secondary location. Required. Known values are: "live", "bootstrap", and "unavailable". @@ -1634,7 +1620,7 @@ class JsonTextConfiguration(_serialization.Model): } _xml_map = {"name": "JsonTextConfiguration"} - def __init__(self, *, record_separator: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, record_separator: Optional[str] = None, **kwargs): """ :keyword record_separator: The string used to separate records. :paramtype record_separator: str @@ -1664,7 +1650,7 @@ class KeyInfo(_serialization.Model): "expiry": {"key": "Expiry", "type": "str"}, } - def __init__(self, *, start: str, expiry: str, **kwargs: Any) -> None: + def __init__(self, *, start: str, expiry: str, **kwargs): """ :keyword start: The date-time the key is active in ISO 8601 UTC time. Required. :paramtype start: str @@ -1688,7 +1674,7 @@ class LeaseAccessConditions(_serialization.Model): "lease_id": {"key": "leaseId", "type": "str"}, } - def __init__(self, *, lease_id: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, lease_id: Optional[str] = None, **kwargs): """ :keyword lease_id: If specified, the operation only succeeds if the resource's lease is active and matches this ID. @@ -1746,8 +1732,8 @@ def __init__( marker: Optional[str] = None, max_results: Optional[int] = None, next_marker: Optional[str] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword service_endpoint: Required. :paramtype service_endpoint: str @@ -1826,8 +1812,8 @@ def __init__( max_results: Optional[int] = None, delimiter: Optional[str] = None, next_marker: Optional[str] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword service_endpoint: Required. :paramtype service_endpoint: str @@ -1904,8 +1890,8 @@ def __init__( marker: Optional[str] = None, max_results: Optional[int] = None, next_marker: Optional[str] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword service_endpoint: Required. :paramtype service_endpoint: str @@ -1971,8 +1957,8 @@ def __init__( read: bool, write: bool, retention_policy: "_models.RetentionPolicy", - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword version: The version of Storage Analytics to configure. Required. :paramtype version: str @@ -2029,8 +2015,8 @@ def __init__( version: Optional[str] = None, include_apis: Optional[bool] = None, retention_policy: Optional["_models.RetentionPolicy"] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword version: The version of Storage Analytics to configure. :paramtype version: str @@ -2084,8 +2070,8 @@ def __init__( if_match: Optional[str] = None, if_none_match: Optional[str] = None, if_tags: Optional[str] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword if_modified_since: Specify this header value to operate only on a blob if it has been modified since the specified date/time. @@ -2133,8 +2119,8 @@ def __init__( page_range: Optional[List["_models.PageRange"]] = None, clear_range: Optional[List["_models.ClearRange"]] = None, next_marker: Optional[str] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword page_range: :paramtype page_range: list[~azure.storage.blob.models.PageRange] @@ -2171,7 +2157,7 @@ class PageRange(_serialization.Model): } _xml_map = {"name": "PageRange"} - def __init__(self, *, start: int, end: int, **kwargs: Any) -> None: + def __init__(self, *, start: int, end: int, **kwargs): """ :keyword start: Required. :paramtype start: int @@ -2223,8 +2209,8 @@ def __init__( json_text_configuration: Optional["_models.JsonTextConfiguration"] = None, arrow_configuration: Optional["_models.ArrowConfiguration"] = None, parquet_text_configuration: Optional[JSON] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword type: The quick query format type. Required. Known values are: "delimited", "json", "arrow", and "parquet". @@ -2288,8 +2274,8 @@ def __init__( expression: str, input_serialization: Optional["_models.QuerySerialization"] = None, output_serialization: Optional["_models.QuerySerialization"] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword expression: The query expression in SQL. The maximum size of the query expression is 256KiB. Required. @@ -2322,7 +2308,7 @@ class QuerySerialization(_serialization.Model): "format": {"key": "Format", "type": "QueryFormat"}, } - def __init__(self, *, format: "_models.QueryFormat", **kwargs: Any) -> None: + def __init__(self, *, format: "_models.QueryFormat", **kwargs): """ :keyword format: Required. :paramtype format: ~azure.storage.blob.models.QueryFormat @@ -2359,8 +2345,8 @@ class RetentionPolicy(_serialization.Model): } def __init__( - self, *, enabled: bool, days: Optional[int] = None, allow_permanent_delete: Optional[bool] = None, **kwargs: Any - ) -> None: + self, *, enabled: bool, days: Optional[int] = None, allow_permanent_delete: Optional[bool] = None, **kwargs + ): """ :keyword enabled: Indicates whether a retention policy is enabled for the storage service. Required. @@ -2404,8 +2390,8 @@ def __init__( if_sequence_number_less_than_or_equal_to: Optional[int] = None, if_sequence_number_less_than: Optional[int] = None, if_sequence_number_equal_to: Optional[int] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword if_sequence_number_less_than_or_equal_to: Specify this header value to operate only on a blob if it has a sequence number less than or equal to the specified. @@ -2449,8 +2435,8 @@ def __init__( *, id: str, # pylint: disable=redefined-builtin access_policy: Optional["_models.AccessPolicy"] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword id: a unique id. Required. :paramtype id: str @@ -2497,8 +2483,8 @@ def __init__( source_if_match: Optional[str] = None, source_if_none_match: Optional[str] = None, source_if_tags: Optional[str] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword source_if_modified_since: Specify this header value to operate only on a blob if it has been modified since the specified date/time. @@ -2556,8 +2542,8 @@ def __init__( index_document: Optional[str] = None, error_document404_path: Optional[str] = None, default_index_document_path: Optional[str] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword enabled: Indicates whether this account is hosting a static website. Required. :paramtype enabled: bool @@ -2586,7 +2572,7 @@ class StorageError(_serialization.Model): "message": {"key": "Message", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, message: Optional[str] = None, **kwargs): """ :keyword message: :paramtype message: str @@ -2639,8 +2625,8 @@ def __init__( default_service_version: Optional[str] = None, delete_retention_policy: Optional["_models.RetentionPolicy"] = None, static_website: Optional["_models.StaticWebsite"] = None, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword logging: Azure Analytics Logging settings. :paramtype logging: ~azure.storage.blob.models.Logging @@ -2683,7 +2669,7 @@ class StorageServiceStats(_serialization.Model): "geo_replication": {"key": "GeoReplication", "type": "GeoReplication"}, } - def __init__(self, *, geo_replication: Optional["_models.GeoReplication"] = None, **kwargs: Any) -> None: + def __init__(self, *, geo_replication: Optional["_models.GeoReplication"] = None, **kwargs): """ :keyword geo_replication: Geo-Replication information for the Secondary Storage Service. :paramtype geo_replication: ~azure.storage.blob.models.GeoReplication @@ -2743,8 +2729,8 @@ def __init__( signed_service: str, signed_version: str, value: str, - **kwargs: Any - ) -> None: + **kwargs + ): """ :keyword signed_oid: The Azure Active Directory object ID in GUID format. Required. :paramtype signed_oid: str diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/__init__.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/__init__.py index 1be05c7aa9a7..f8feb32687ac 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/__init__.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/__init__.py @@ -14,7 +14,7 @@ from ._block_blob_operations import BlockBlobOperations from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py index 284a9de13a95..366954fef51d 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py @@ -7,7 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -15,7 +14,6 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, - ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,10 +26,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +48,7 @@ def build_create_request( blob_content_disposition: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, + encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, encryption_scope: Optional[str] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -64,15 +58,15 @@ def build_create_request( request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, + immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, legal_hold: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - blob_type: Literal["AppendBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "AppendBlob")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "AppendBlob")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -81,7 +75,7 @@ def build_create_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters if timeout is not None: @@ -165,7 +159,7 @@ def build_append_block_request( append_position: Optional[int] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, + encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, encryption_scope: Optional[str] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -178,9 +172,9 @@ def build_append_block_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["appendblock"] = kwargs.pop("comp", _params.pop("comp", "appendblock")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "appendblock")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -189,7 +183,7 @@ def build_append_block_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -254,7 +248,7 @@ def build_append_block_from_url_request( transactional_content_md5: Optional[bytes] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, + encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, encryption_scope: Optional[str] = None, lease_id: Optional[str] = None, max_size: Optional[int] = None, @@ -275,8 +269,8 @@ def build_append_block_from_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["appendblock"] = kwargs.pop("comp", _params.pop("comp", "appendblock")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "appendblock")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -285,7 +279,7 @@ def build_append_block_from_url_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -373,8 +367,8 @@ def build_seal_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["seal"] = kwargs.pop("comp", _params.pop("comp", "seal")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "seal")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -383,7 +377,7 @@ def build_seal_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -439,7 +433,7 @@ def create( # pylint: disable=inconsistent-return-statements request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, + immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, legal_hold: Optional[bool] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -499,19 +493,14 @@ def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - blob_type: Literal["AppendBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "AppendBlob")) - cls: ClsType[None] = kwargs.pop("cls", None) + blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "AppendBlob")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _blob_content_type = None _blob_content_encoding = None @@ -584,9 +573,9 @@ def create( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -621,7 +610,7 @@ def create( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {"url": "{url}/{containerName}/{blob}"} + create.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def append_block( # pylint: disable=inconsistent-return-statements @@ -681,20 +670,15 @@ def append_block( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["appendblock"] = kwargs.pop("comp", _params.pop("comp", "appendblock")) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "appendblock")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _max_size = None @@ -755,9 +739,9 @@ def append_block( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -800,7 +784,7 @@ def append_block( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - append_block.metadata = {"url": "{url}/{containerName}/{blob}"} + append_block.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def append_block_from_url( # pylint: disable=inconsistent-return-statements @@ -876,19 +860,14 @@ def append_block_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["appendblock"] = kwargs.pop("comp", _params.pop("comp", "appendblock")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "appendblock")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _encryption_key = None _encryption_key_sha256 = None @@ -963,9 +942,9 @@ def append_block_from_url( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1005,7 +984,7 @@ def append_block_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - append_block_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} + append_block_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def seal( # pylint: disable=inconsistent-return-statements @@ -1044,19 +1023,14 @@ def seal( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["seal"] = kwargs.pop("comp", _params.pop("comp", "seal")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "seal")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _if_modified_since = None @@ -1091,9 +1065,9 @@ def seal( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1118,4 +1092,4 @@ def seal( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - seal.metadata = {"url": "{url}/{containerName}/{blob}"} + seal.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py index 23eade967337..bbe2f1427b0e 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py @@ -7,7 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys from typing import Any, Callable, Dict, Iterator, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -15,7 +14,6 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, - ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,10 +26,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +45,7 @@ def build_download_request( range_get_content_crc64: Optional[bool] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, + encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, if_match: Optional[str] = None, @@ -63,7 +57,7 @@ def build_download_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -72,7 +66,7 @@ def build_download_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters if snapshot is not None: @@ -130,7 +124,7 @@ def build_get_properties_request( lease_id: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, + encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, if_match: Optional[str] = None, @@ -142,7 +136,7 @@ def build_get_properties_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -151,7 +145,7 @@ def build_get_properties_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters if snapshot is not None: @@ -197,20 +191,20 @@ def build_delete_request( version_id: Optional[str] = None, timeout: Optional[int] = None, lease_id: Optional[str] = None, - delete_snapshots: Optional[Union[str, _models.DeleteSnapshotsOptionType]] = None, + delete_snapshots: Optional[Union[str, "_models.DeleteSnapshotsOptionType"]] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, if_match: Optional[str] = None, if_none_match: Optional[str] = None, if_tags: Optional[str] = None, request_id_parameter: Optional[str] = None, - blob_delete_type: Literal["Permanent"] = "Permanent", + blob_delete_type: str = "Permanent", **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -219,7 +213,7 @@ def build_delete_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters if snapshot is not None: @@ -260,8 +254,8 @@ def build_undelete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["undelete"] = kwargs.pop("comp", _params.pop("comp", "undelete")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "undelete")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -270,7 +264,7 @@ def build_undelete_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -289,7 +283,7 @@ def build_undelete_request( def build_set_expiry_request( url: str, *, - expiry_options: Union[str, _models.BlobExpiryOptions], + expiry_options: Union[str, "_models.BlobExpiryOptions"], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, expires_on: Optional[str] = None, @@ -298,8 +292,8 @@ def build_set_expiry_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["expiry"] = kwargs.pop("comp", _params.pop("comp", "expiry")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "expiry")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -308,7 +302,7 @@ def build_set_expiry_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -349,8 +343,8 @@ def build_set_http_headers_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -359,7 +353,7 @@ def build_set_http_headers_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -412,14 +406,14 @@ def build_set_immutability_policy_request( request_id_parameter: Optional[str] = None, if_unmodified_since: Optional[datetime.datetime] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, + immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["immutabilityPolicies"] = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -428,7 +422,7 @@ def build_set_immutability_policy_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -460,8 +454,8 @@ def build_delete_immutability_policy_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["immutabilityPolicies"] = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -470,7 +464,7 @@ def build_delete_immutability_policy_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -497,8 +491,8 @@ def build_set_legal_hold_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["legalhold"] = kwargs.pop("comp", _params.pop("comp", "legalhold")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "legalhold")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -507,7 +501,7 @@ def build_set_legal_hold_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -532,7 +526,7 @@ def build_set_metadata_request( lease_id: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, + encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, encryption_scope: Optional[str] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -545,8 +539,8 @@ def build_set_metadata_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "metadata")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -555,7 +549,7 @@ def build_set_metadata_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -612,9 +606,9 @@ def build_acquire_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -623,7 +617,7 @@ def build_acquire_lease_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -670,9 +664,9 @@ def build_release_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -681,7 +675,7 @@ def build_release_lease_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -725,9 +719,9 @@ def build_renew_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -736,7 +730,7 @@ def build_renew_lease_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -781,9 +775,9 @@ def build_change_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -792,7 +786,7 @@ def build_change_lease_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -837,9 +831,9 @@ def build_break_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -848,7 +842,7 @@ def build_break_lease_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -884,7 +878,7 @@ def build_create_snapshot_request( metadata: Optional[Dict[str, str]] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, + encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, encryption_scope: Optional[str] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -898,8 +892,8 @@ def build_create_snapshot_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["snapshot"] = kwargs.pop("comp", _params.pop("comp", "snapshot")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "snapshot")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -908,7 +902,7 @@ def build_create_snapshot_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -954,8 +948,8 @@ def build_start_copy_from_url_request( copy_source: str, timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, _models.AccessTierOptional]] = None, - rehydrate_priority: Optional[Union[str, _models.RehydratePriority]] = None, + tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, + rehydrate_priority: Optional[Union[str, "_models.RehydratePriority"]] = None, source_if_modified_since: Optional[datetime.datetime] = None, source_if_unmodified_since: Optional[datetime.datetime] = None, source_if_match: Optional[str] = None, @@ -971,14 +965,14 @@ def build_start_copy_from_url_request( blob_tags_string: Optional[str] = None, seal_blob: Optional[bool] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, + immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, legal_hold: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -987,7 +981,7 @@ def build_start_copy_from_url_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters if timeout is not None: @@ -1055,7 +1049,7 @@ def build_copy_from_url_request( copy_source: str, timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, _models.AccessTierOptional]] = None, + tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, source_if_modified_since: Optional[datetime.datetime] = None, source_if_unmodified_since: Optional[datetime.datetime] = None, source_if_match: Optional[str] = None, @@ -1070,18 +1064,18 @@ def build_copy_from_url_request( source_content_md5: Optional[bytes] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, + immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, legal_hold: Optional[bool] = None, copy_source_authorization: Optional[str] = None, encryption_scope: Optional[str] = None, - copy_source_tags: Optional[Union[str, _models.BlobCopySourceTags]] = None, + copy_source_tags: Optional[Union[str, "_models.BlobCopySourceTags"]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - x_ms_requires_sync: Literal["true"] = kwargs.pop("x_ms_requires_sync", _headers.pop("x-ms-requires-sync", "true")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + x_ms_requires_sync = kwargs.pop("x_ms_requires_sync", _headers.pop("x-ms-requires-sync", "true")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1090,7 +1084,7 @@ def build_copy_from_url_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters if timeout is not None: @@ -1169,11 +1163,11 @@ def build_abort_copy_from_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["copy"] = kwargs.pop("comp", _params.pop("comp", "copy")) - copy_action_abort_constant: Literal["abort"] = kwargs.pop( + comp = kwargs.pop("comp", _params.pop("comp", "copy")) # type: str + copy_action_abort_constant = kwargs.pop( "copy_action_abort_constant", _headers.pop("x-ms-copy-action", "abort") - ) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + ) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1182,7 +1176,7 @@ def build_abort_copy_from_url_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -1205,11 +1199,11 @@ def build_abort_copy_from_url_request( def build_set_tier_request( url: str, *, - tier: Union[str, _models.AccessTierRequired], + tier: Union[str, "_models.AccessTierRequired"], snapshot: Optional[str] = None, version_id: Optional[str] = None, timeout: Optional[int] = None, - rehydrate_priority: Optional[Union[str, _models.RehydratePriority]] = None, + rehydrate_priority: Optional[Union[str, "_models.RehydratePriority"]] = None, request_id_parameter: Optional[str] = None, lease_id: Optional[str] = None, if_tags: Optional[str] = None, @@ -1218,8 +1212,8 @@ def build_set_tier_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["tier"] = kwargs.pop("comp", _params.pop("comp", "tier")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "tier")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1228,7 +1222,7 @@ def build_set_tier_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -1259,9 +1253,9 @@ def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account")) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + restype = kwargs.pop("restype", _params.pop("restype", "account")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1270,7 +1264,7 @@ def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -1291,7 +1285,7 @@ def build_query_request( lease_id: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, + encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, if_match: Optional[str] = None, @@ -1304,9 +1298,9 @@ def build_query_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["query"] = kwargs.pop("comp", _params.pop("comp", "query")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "query")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1315,7 +1309,7 @@ def build_query_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -1369,8 +1363,8 @@ def build_get_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["tags"] = kwargs.pop("comp", _params.pop("comp", "tags")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "tags")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1379,7 +1373,7 @@ def build_get_tags_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -1419,9 +1413,9 @@ def build_set_tags_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["tags"] = kwargs.pop("comp", _params.pop("comp", "tags")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "tags")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1430,7 +1424,7 @@ def build_set_tags_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -1539,18 +1533,13 @@ def download( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls = kwargs.pop("cls", None) # type: ClsType[Iterator[bytes]] _lease_id = None _encryption_key = None @@ -1598,9 +1587,9 @@ def download( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=True, **kwargs ) @@ -1778,11 +1767,11 @@ def download( deserialized = response.stream_download(self._client._pipeline) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) - return deserialized # type: ignore + return deserialized - download.metadata = {"url": "{url}/{containerName}/{blob}"} + download.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def get_properties( # pylint: disable=inconsistent-return-statements @@ -1829,18 +1818,13 @@ def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _encryption_key = None @@ -1885,9 +1869,9 @@ def get_properties( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1988,7 +1972,7 @@ def get_properties( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {"url": "{url}/{containerName}/{blob}"} + get_properties.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1996,9 +1980,9 @@ def delete( # pylint: disable=inconsistent-return-statements snapshot: Optional[str] = None, version_id: Optional[str] = None, timeout: Optional[int] = None, - delete_snapshots: Optional[Union[str, _models.DeleteSnapshotsOptionType]] = None, + delete_snapshots: Optional[Union[str, "_models.DeleteSnapshotsOptionType"]] = None, request_id_parameter: Optional[str] = None, - blob_delete_type: Literal["Permanent"] = "Permanent", + blob_delete_type: str = "Permanent", lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, **kwargs: Any @@ -2053,18 +2037,13 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _if_modified_since = None @@ -2101,9 +2080,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2125,7 +2104,7 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {"url": "{url}/{containerName}/{blob}"} + delete.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def undelete( # pylint: disable=inconsistent-return-statements @@ -2150,19 +2129,14 @@ def undelete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["undelete"] = kwargs.pop("comp", _params.pop("comp", "undelete")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "undelete")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_undelete_request( url=self._config.url, @@ -2175,9 +2149,9 @@ def undelete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2199,12 +2173,12 @@ def undelete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - undelete.metadata = {"url": "{url}/{containerName}/{blob}"} + undelete.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def set_expiry( # pylint: disable=inconsistent-return-statements self, - expiry_options: Union[str, _models.BlobExpiryOptions], + expiry_options: Union[str, "_models.BlobExpiryOptions"], timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, expires_on: Optional[str] = None, @@ -2234,19 +2208,14 @@ def set_expiry( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["expiry"] = kwargs.pop("comp", _params.pop("comp", "expiry")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "expiry")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_set_expiry_request( url=self._config.url, @@ -2261,9 +2230,9 @@ def set_expiry( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2287,7 +2256,7 @@ def set_expiry( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_expiry.metadata = {"url": "{url}/{containerName}/{blob}"} + set_expiry.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def set_http_headers( # pylint: disable=inconsistent-return-statements @@ -2324,19 +2293,14 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _blob_cache_control = None _blob_content_type = None @@ -2389,9 +2353,9 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2418,7 +2382,7 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_http_headers.metadata = {"url": "{url}/{containerName}/{blob}"} + set_http_headers.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def set_immutability_policy( # pylint: disable=inconsistent-return-statements @@ -2426,7 +2390,7 @@ def set_immutability_policy( # pylint: disable=inconsistent-return-statements timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, + immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, **kwargs: Any ) -> None: @@ -2457,19 +2421,14 @@ def set_immutability_policy( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["immutabilityPolicies"] = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_unmodified_since = None if modified_access_conditions is not None: @@ -2489,9 +2448,9 @@ def set_immutability_policy( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2519,7 +2478,7 @@ def set_immutability_policy( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_immutability_policy.metadata = {"url": "{url}/{containerName}/{blob}"} + set_immutability_policy.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def delete_immutability_policy( # pylint: disable=inconsistent-return-statements @@ -2544,19 +2503,14 @@ def delete_immutability_policy( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["immutabilityPolicies"] = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_immutability_policy_request( url=self._config.url, @@ -2569,9 +2523,9 @@ def delete_immutability_policy( # pylint: disable=inconsistent-return-statement params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2593,7 +2547,7 @@ def delete_immutability_policy( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, response_headers) - delete_immutability_policy.metadata = {"url": "{url}/{containerName}/{blob}"} + delete_immutability_policy.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def set_legal_hold( # pylint: disable=inconsistent-return-statements @@ -2620,19 +2574,14 @@ def set_legal_hold( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["legalhold"] = kwargs.pop("comp", _params.pop("comp", "legalhold")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "legalhold")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_set_legal_hold_request( url=self._config.url, @@ -2646,9 +2595,9 @@ def set_legal_hold( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2671,7 +2620,7 @@ def set_legal_hold( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_legal_hold.metadata = {"url": "{url}/{containerName}/{blob}"} + set_legal_hold.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def set_metadata( # pylint: disable=inconsistent-return-statements @@ -2721,19 +2670,14 @@ def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "metadata")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _encryption_key = None @@ -2782,9 +2726,9 @@ def set_metadata( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2818,7 +2762,7 @@ def set_metadata( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_metadata.metadata = {"url": "{url}/{containerName}/{blob}"} + set_metadata.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def acquire_lease( # pylint: disable=inconsistent-return-statements @@ -2863,20 +2807,15 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -2909,9 +2848,9 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2936,7 +2875,7 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - acquire_lease.metadata = {"url": "{url}/{containerName}/{blob}"} + acquire_lease.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def release_lease( # pylint: disable=inconsistent-return-statements @@ -2974,20 +2913,15 @@ def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -3019,9 +2953,9 @@ def release_lease( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3045,7 +2979,7 @@ def release_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - release_lease.metadata = {"url": "{url}/{containerName}/{blob}"} + release_lease.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def renew_lease( # pylint: disable=inconsistent-return-statements @@ -3083,20 +3017,15 @@ def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -3128,9 +3057,9 @@ def renew_lease( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3155,7 +3084,7 @@ def renew_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - renew_lease.metadata = {"url": "{url}/{containerName}/{blob}"} + renew_lease.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def change_lease( # pylint: disable=inconsistent-return-statements @@ -3198,20 +3127,15 @@ def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -3244,9 +3168,9 @@ def change_lease( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3271,7 +3195,7 @@ def change_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - change_lease.metadata = {"url": "{url}/{containerName}/{blob}"} + change_lease.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def break_lease( # pylint: disable=inconsistent-return-statements @@ -3315,20 +3239,15 @@ def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -3360,9 +3279,9 @@ def break_lease( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3387,7 +3306,7 @@ def break_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - break_lease.metadata = {"url": "{url}/{containerName}/{blob}"} + break_lease.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def create_snapshot( # pylint: disable=inconsistent-return-statements @@ -3436,19 +3355,14 @@ def create_snapshot( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["snapshot"] = kwargs.pop("comp", _params.pop("comp", "snapshot")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "snapshot")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _encryption_key = None _encryption_key_sha256 = None @@ -3497,9 +3411,9 @@ def create_snapshot( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3528,7 +3442,7 @@ def create_snapshot( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - create_snapshot.metadata = {"url": "{url}/{containerName}/{blob}"} + create_snapshot.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def start_copy_from_url( # pylint: disable=inconsistent-return-statements @@ -3536,13 +3450,13 @@ def start_copy_from_url( # pylint: disable=inconsistent-return-statements copy_source: str, timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, _models.AccessTierOptional]] = None, - rehydrate_priority: Optional[Union[str, _models.RehydratePriority]] = None, + tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, + rehydrate_priority: Optional[Union[str, "_models.RehydratePriority"]] = None, request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, seal_blob: Optional[bool] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, + immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, legal_hold: Optional[bool] = None, source_modified_access_conditions: Optional[_models.SourceModifiedAccessConditions] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, @@ -3606,18 +3520,13 @@ def start_copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + cls = kwargs.pop("cls", None) # type: ClsType[None] _source_if_modified_since = None _source_if_unmodified_since = None @@ -3675,9 +3584,9 @@ def start_copy_from_url( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3704,7 +3613,7 @@ def start_copy_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - start_copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} + start_copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def copy_from_url( # pylint: disable=inconsistent-return-statements @@ -3712,15 +3621,15 @@ def copy_from_url( # pylint: disable=inconsistent-return-statements copy_source: str, timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, _models.AccessTierOptional]] = None, + tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, request_id_parameter: Optional[str] = None, source_content_md5: Optional[bytes] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, + immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, legal_hold: Optional[bool] = None, copy_source_authorization: Optional[str] = None, - copy_source_tags: Optional[Union[str, _models.BlobCopySourceTags]] = None, + copy_source_tags: Optional[Union[str, "_models.BlobCopySourceTags"]] = None, source_modified_access_conditions: Optional[_models.SourceModifiedAccessConditions] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -3795,21 +3704,14 @@ def copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - x_ms_requires_sync: Literal["true"] = kwargs.pop( - "x_ms_requires_sync", _headers.pop("x-ms-requires-sync", "true") - ) - cls: ClsType[None] = kwargs.pop("cls", None) + x_ms_requires_sync = kwargs.pop("x_ms_requires_sync", _headers.pop("x-ms-requires-sync", "true")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _source_if_modified_since = None _source_if_unmodified_since = None @@ -3870,9 +3772,9 @@ def copy_from_url( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -3906,7 +3808,7 @@ def copy_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} + copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def abort_copy_from_url( # pylint: disable=inconsistent-return-statements @@ -3945,22 +3847,17 @@ def abort_copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["copy"] = kwargs.pop("comp", _params.pop("comp", "copy")) - copy_action_abort_constant: Literal["abort"] = kwargs.pop( + comp = kwargs.pop("comp", _params.pop("comp", "copy")) # type: str + copy_action_abort_constant = kwargs.pop( "copy_action_abort_constant", _headers.pop("x-ms-copy-action", "abort") - ) - cls: ClsType[None] = kwargs.pop("cls", None) + ) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None if lease_access_conditions is not None: @@ -3980,9 +3877,9 @@ def abort_copy_from_url( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4004,16 +3901,16 @@ def abort_copy_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - abort_copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} + abort_copy_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def set_tier( # pylint: disable=inconsistent-return-statements self, - tier: Union[str, _models.AccessTierRequired], + tier: Union[str, "_models.AccessTierRequired"], snapshot: Optional[str] = None, version_id: Optional[str] = None, timeout: Optional[int] = None, - rehydrate_priority: Optional[Union[str, _models.RehydratePriority]] = None, + rehydrate_priority: Optional[Union[str, "_models.RehydratePriority"]] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, @@ -4063,19 +3960,14 @@ def set_tier( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["tier"] = kwargs.pop("comp", _params.pop("comp", "tier")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "tier")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _if_tags = None @@ -4101,9 +3993,9 @@ def set_tier( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4132,7 +4024,7 @@ def set_tier( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_tier.metadata = {"url": "{url}/{containerName}/{blob}"} + set_tier.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -4149,20 +4041,15 @@ def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account")) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "account")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_get_account_info_request( url=self._config.url, @@ -4174,9 +4061,9 @@ def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsiste params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4200,7 +4087,7 @@ def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsiste if cls: return cls(pipeline_response, None, response_headers) - get_account_info.metadata = {"url": "{url}/{containerName}/{blob}"} + get_account_info.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def query( @@ -4248,20 +4135,15 @@ def query( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["query"] = kwargs.pop("comp", _params.pop("comp", "query")) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "query")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Iterator[bytes]] _lease_id = None _encryption_key = None @@ -4312,9 +4194,9 @@ def query( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=True, **kwargs ) @@ -4450,11 +4332,11 @@ def query( deserialized = response.stream_download(self._client._pipeline) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) - return deserialized # type: ignore + return deserialized - query.metadata = {"url": "{url}/{containerName}/{blob}"} + query.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def get_tags( @@ -4500,19 +4382,14 @@ def get_tags( :rtype: ~azure.storage.blob.models.BlobTags :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["tags"] = kwargs.pop("comp", _params.pop("comp", "tags")) - cls: ClsType[_models.BlobTags] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "tags")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BlobTags] _if_tags = None _lease_id = None @@ -4536,9 +4413,9 @@ def get_tags( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4564,7 +4441,7 @@ def get_tags( return deserialized - get_tags.metadata = {"url": "{url}/{containerName}/{blob}"} + get_tags.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def set_tags( # pylint: disable=inconsistent-return-statements @@ -4614,20 +4491,15 @@ def set_tags( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["tags"] = kwargs.pop("comp", _params.pop("comp", "tags")) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "tags")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_tags = None _lease_id = None @@ -4658,9 +4530,9 @@ def set_tags( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -4682,4 +4554,4 @@ def set_tags( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_tags.metadata = {"url": "{url}/{containerName}/{blob}"} + set_tags.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py index d462aa84f7cb..5435f0a2c33d 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py @@ -7,7 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -15,7 +14,6 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, - ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,10 +26,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,9 +50,9 @@ def build_upload_request( blob_content_disposition: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, + encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, encryption_scope: Optional[str] = None, - tier: Optional[Union[str, _models.AccessTierOptional]] = None, + tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, if_match: Optional[str] = None, @@ -67,7 +61,7 @@ def build_upload_request( request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, + immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, legal_hold: Optional[bool] = None, transactional_content_crc64: Optional[bytes] = None, **kwargs: Any @@ -75,9 +69,9 @@ def build_upload_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - blob_type: Literal["BlockBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -86,7 +80,7 @@ def build_upload_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters if timeout is not None: @@ -186,9 +180,9 @@ def build_put_blob_from_url_request( blob_content_disposition: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, + encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, encryption_scope: Optional[str] = None, - tier: Optional[Union[str, _models.AccessTierOptional]] = None, + tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, if_match: Optional[str] = None, @@ -204,14 +198,14 @@ def build_put_blob_from_url_request( blob_tags_string: Optional[str] = None, copy_source_blob_properties: Optional[bool] = None, copy_source_authorization: Optional[str] = None, - copy_source_tags: Optional[Union[str, _models.BlobCopySourceTags]] = None, + copy_source_tags: Optional[Union[str, "_models.BlobCopySourceTags"]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - blob_type: Literal["BlockBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -220,7 +214,7 @@ def build_put_blob_from_url_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters if timeout is not None: @@ -326,7 +320,7 @@ def build_stage_block_request( lease_id: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, + encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, encryption_scope: Optional[str] = None, request_id_parameter: Optional[str] = None, **kwargs: Any @@ -334,9 +328,9 @@ def build_stage_block_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["block"] = kwargs.pop("comp", _params.pop("comp", "block")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "block")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -345,7 +339,7 @@ def build_stage_block_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -397,7 +391,7 @@ def build_stage_block_from_url_request( timeout: Optional[int] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, + encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, encryption_scope: Optional[str] = None, lease_id: Optional[str] = None, source_if_modified_since: Optional[datetime.datetime] = None, @@ -411,8 +405,8 @@ def build_stage_block_from_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["block"] = kwargs.pop("comp", _params.pop("comp", "block")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "block")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -421,7 +415,7 @@ def build_stage_block_from_url_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -493,9 +487,9 @@ def build_commit_block_list_request( blob_content_disposition: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, + encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, encryption_scope: Optional[str] = None, - tier: Optional[Union[str, _models.AccessTierOptional]] = None, + tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, if_match: Optional[str] = None, @@ -504,16 +498,16 @@ def build_commit_block_list_request( request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, + immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, legal_hold: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["blocklist"] = kwargs.pop("comp", _params.pop("comp", "blocklist")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "blocklist")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -522,7 +516,7 @@ def build_commit_block_list_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -608,7 +602,7 @@ def build_get_block_list_request( url: str, *, snapshot: Optional[str] = None, - list_type: Union[str, _models.BlockListType] = "committed", + list_type: Union[str, "_models.BlockListType"] = "committed", timeout: Optional[int] = None, lease_id: Optional[str] = None, if_tags: Optional[str] = None, @@ -618,8 +612,8 @@ def build_get_block_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["blocklist"] = kwargs.pop("comp", _params.pop("comp", "blocklist")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "blocklist")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -628,7 +622,7 @@ def build_get_block_list_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -678,11 +672,11 @@ def upload( # pylint: disable=inconsistent-return-statements timeout: Optional[int] = None, transactional_content_md5: Optional[bytes] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, _models.AccessTierOptional]] = None, + tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, + immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, legal_hold: Optional[bool] = None, transactional_content_crc64: Optional[bytes] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, @@ -759,20 +753,15 @@ def upload( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - blob_type: Literal["BlockBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) - cls: ClsType[None] = kwargs.pop("cls", None) + blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _blob_content_type = None _blob_content_encoding = None @@ -851,9 +840,9 @@ def upload( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -888,7 +877,7 @@ def upload( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - upload.metadata = {"url": "{url}/{containerName}/{blob}"} + upload.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def put_blob_from_url( # pylint: disable=inconsistent-return-statements @@ -898,13 +887,13 @@ def put_blob_from_url( # pylint: disable=inconsistent-return-statements timeout: Optional[int] = None, transactional_content_md5: Optional[bytes] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, _models.AccessTierOptional]] = None, + tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, request_id_parameter: Optional[str] = None, source_content_md5: Optional[bytes] = None, blob_tags_string: Optional[str] = None, copy_source_blob_properties: Optional[bool] = None, copy_source_authorization: Optional[str] = None, - copy_source_tags: Optional[Union[str, _models.BlobCopySourceTags]] = None, + copy_source_tags: Optional[Union[str, "_models.BlobCopySourceTags"]] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, cpk_info: Optional[_models.CpkInfo] = None, @@ -988,19 +977,14 @@ def put_blob_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - blob_type: Literal["BlockBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) - cls: ClsType[None] = kwargs.pop("cls", None) + blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _blob_content_type = None _blob_content_encoding = None @@ -1093,9 +1077,9 @@ def put_blob_from_url( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1130,7 +1114,7 @@ def put_blob_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - put_blob_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} + put_blob_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def stage_block( # pylint: disable=inconsistent-return-statements @@ -1186,20 +1170,15 @@ def stage_block( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["block"] = kwargs.pop("comp", _params.pop("comp", "block")) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "block")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _encryption_key = None @@ -1238,9 +1217,9 @@ def stage_block( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1275,7 +1254,7 @@ def stage_block( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - stage_block.metadata = {"url": "{url}/{containerName}/{blob}"} + stage_block.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def stage_block_from_url( # pylint: disable=inconsistent-return-statements @@ -1343,19 +1322,14 @@ def stage_block_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["block"] = kwargs.pop("comp", _params.pop("comp", "block")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "block")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _encryption_key = None _encryption_key_sha256 = None @@ -1407,9 +1381,9 @@ def stage_block_from_url( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1444,7 +1418,7 @@ def stage_block_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - stage_block_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} + stage_block_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def commit_block_list( # pylint: disable=inconsistent-return-statements @@ -1454,11 +1428,11 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements transactional_content_md5: Optional[bytes] = None, transactional_content_crc64: Optional[bytes] = None, metadata: Optional[Dict[str, str]] = None, - tier: Optional[Union[str, _models.AccessTierOptional]] = None, + tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, + immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, legal_hold: Optional[bool] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -1533,20 +1507,15 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["blocklist"] = kwargs.pop("comp", _params.pop("comp", "blocklist")) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "blocklist")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _blob_cache_control = None _blob_content_type = None @@ -1624,9 +1593,9 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1664,13 +1633,13 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - commit_block_list.metadata = {"url": "{url}/{containerName}/{blob}"} + commit_block_list.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def get_block_list( self, snapshot: Optional[str] = None, - list_type: Union[str, _models.BlockListType] = "committed", + list_type: Union[str, "_models.BlockListType"] = "committed", timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -1711,19 +1680,14 @@ def get_block_list( :rtype: ~azure.storage.blob.models.BlockList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["blocklist"] = kwargs.pop("comp", _params.pop("comp", "blocklist")) - cls: ClsType[_models.BlockList] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "blocklist")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.BlockList] _lease_id = None _if_tags = None @@ -1747,9 +1711,9 @@ def get_block_list( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1781,4 +1745,4 @@ def get_block_list( return deserialized - get_block_list.metadata = {"url": "{url}/{containerName}/{blob}"} + get_block_list.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py index c72507ba55ff..7b95b3e481ea 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py @@ -7,7 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys from typing import Any, Callable, Dict, IO, Iterator, List, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -15,7 +14,6 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, - ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,10 +26,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +38,7 @@ def build_create_request( *, timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, - access: Optional[Union[str, _models.PublicAccessType]] = None, + access: Optional[Union[str, "_models.PublicAccessType"]] = None, request_id_parameter: Optional[str] = None, default_encryption_scope: Optional[str] = None, prevent_encryption_scope_override: Optional[bool] = None, @@ -53,8 +47,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -63,7 +57,7 @@ def build_create_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -102,8 +96,8 @@ def build_get_properties_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -112,7 +106,7 @@ def build_get_properties_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -143,8 +137,8 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -153,7 +147,7 @@ def build_delete_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -188,9 +182,9 @@ def build_set_metadata_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "metadata")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -199,7 +193,7 @@ def build_set_metadata_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -233,9 +227,9 @@ def build_get_access_policy_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["acl"] = kwargs.pop("comp", _params.pop("comp", "acl")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "acl")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -244,7 +238,7 @@ def build_get_access_policy_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -268,7 +262,7 @@ def build_set_access_policy_request( *, timeout: Optional[int] = None, lease_id: Optional[str] = None, - access: Optional[Union[str, _models.PublicAccessType]] = None, + access: Optional[Union[str, "_models.PublicAccessType"]] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, request_id_parameter: Optional[str] = None, @@ -278,10 +272,10 @@ def build_set_access_policy_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["acl"] = kwargs.pop("comp", _params.pop("comp", "acl")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "acl")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -290,7 +284,7 @@ def build_set_access_policy_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -329,9 +323,9 @@ def build_restore_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["undelete"] = kwargs.pop("comp", _params.pop("comp", "undelete")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "undelete")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -340,7 +334,7 @@ def build_restore_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -377,9 +371,9 @@ def build_rename_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["rename"] = kwargs.pop("comp", _params.pop("comp", "rename")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "rename")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -388,7 +382,7 @@ def build_rename_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -420,10 +414,12 @@ def build_submit_batch_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["batch"] = kwargs.pop("comp", _params.pop("comp", "batch")) - multipart_content_type: Optional[str] = kwargs.pop("multipart_content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "batch")) # type: str + multipart_content_type = kwargs.pop( + "multipart_content_type", _headers.pop("Content-Type", None) + ) # type: Optional[str] + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -432,7 +428,7 @@ def build_submit_batch_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -460,15 +456,15 @@ def build_filter_blobs_request( where: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, _models.FilterBlobsIncludeItem]]] = None, + include: Optional[List[Union[str, "_models.FilterBlobsIncludeItem"]]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["blobs"] = kwargs.pop("comp", _params.pop("comp", "blobs")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "blobs")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -477,7 +473,7 @@ def build_filter_blobs_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -516,10 +512,10 @@ def build_acquire_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -528,7 +524,7 @@ def build_acquire_lease_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -567,10 +563,10 @@ def build_release_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -579,7 +575,7 @@ def build_release_lease_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -615,10 +611,10 @@ def build_renew_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -627,7 +623,7 @@ def build_renew_lease_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -663,10 +659,10 @@ def build_break_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -675,7 +671,7 @@ def build_break_lease_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -713,10 +709,10 @@ def build_change_lease_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -725,7 +721,7 @@ def build_change_lease_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -755,7 +751,7 @@ def build_list_blob_flat_segment_request( prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, _models.ListBlobsIncludeItem]]] = None, + include: Optional[List[Union[str, "_models.ListBlobsIncludeItem"]]] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any @@ -763,9 +759,9 @@ def build_list_blob_flat_segment_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "list")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -774,7 +770,7 @@ def build_list_blob_flat_segment_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -806,7 +802,7 @@ def build_list_blob_hierarchy_segment_request( prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, _models.ListBlobsIncludeItem]]] = None, + include: Optional[List[Union[str, "_models.ListBlobsIncludeItem"]]] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any @@ -814,9 +810,9 @@ def build_list_blob_hierarchy_segment_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "list")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -825,7 +821,7 @@ def build_list_blob_hierarchy_segment_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -855,9 +851,9 @@ def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account")) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + restype = kwargs.pop("restype", _params.pop("restype", "account")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -866,7 +862,7 @@ def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -903,7 +899,7 @@ def create( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, metadata: Optional[Dict[str, str]] = None, - access: Optional[Union[str, _models.PublicAccessType]] = None, + access: Optional[Union[str, "_models.PublicAccessType"]] = None, request_id_parameter: Optional[str] = None, container_cpk_scope_info: Optional[_models.ContainerCpkScopeInfo] = None, **kwargs: Any @@ -941,19 +937,14 @@ def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _default_encryption_scope = None _prevent_encryption_scope_override = None @@ -976,9 +967,9 @@ def create( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1002,7 +993,7 @@ def create( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {"url": "{url}/{containerName}"} + create.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace def get_properties( # pylint: disable=inconsistent-return-statements @@ -1034,19 +1025,14 @@ def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None if lease_access_conditions is not None: @@ -1064,9 +1050,9 @@ def get_properties( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1110,7 +1096,7 @@ def get_properties( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {"url": "{url}/{containerName}"} + get_properties.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -1145,19 +1131,14 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _if_modified_since = None @@ -1182,9 +1163,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1206,7 +1187,7 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {"url": "{url}/{containerName}"} + delete.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace def set_metadata( # pylint: disable=inconsistent-return-statements @@ -1252,20 +1233,15 @@ def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "metadata")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _if_modified_since = None @@ -1289,9 +1265,9 @@ def set_metadata( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1315,7 +1291,7 @@ def set_metadata( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_metadata.metadata = {"url": "{url}/{containerName}"} + set_metadata.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace def get_access_policy( @@ -1350,20 +1326,15 @@ def get_access_policy( :rtype: list[~azure.storage.blob.models.SignedIdentifier] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["acl"] = kwargs.pop("comp", _params.pop("comp", "acl")) - cls: ClsType[List[_models.SignedIdentifier]] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "acl")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[List[_models.SignedIdentifier]] _lease_id = None if lease_access_conditions is not None: @@ -1382,9 +1353,9 @@ def get_access_policy( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1415,13 +1386,13 @@ def get_access_policy( return deserialized - get_access_policy.metadata = {"url": "{url}/{containerName}"} + get_access_policy.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace def set_access_policy( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, - access: Optional[Union[str, _models.PublicAccessType]] = None, + access: Optional[Union[str, "_models.PublicAccessType"]] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None, @@ -1460,21 +1431,16 @@ def set_access_policy( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["acl"] = kwargs.pop("comp", _params.pop("comp", "acl")) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "acl")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _if_modified_since = None @@ -1510,9 +1476,9 @@ def set_access_policy( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1536,7 +1502,7 @@ def set_access_policy( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_access_policy.metadata = {"url": "{url}/{containerName}"} + set_access_policy.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace def restore( # pylint: disable=inconsistent-return-statements @@ -1575,20 +1541,15 @@ def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["undelete"] = kwargs.pop("comp", _params.pop("comp", "undelete")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "undelete")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_restore_request( url=self._config.url, @@ -1604,9 +1565,9 @@ def restore( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1628,7 +1589,7 @@ def restore( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - restore.metadata = {"url": "{url}/{containerName}"} + restore.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace def rename( # pylint: disable=inconsistent-return-statements @@ -1667,20 +1628,15 @@ def rename( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["rename"] = kwargs.pop("comp", _params.pop("comp", "rename")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "rename")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_rename_request( url=self._config.url, @@ -1696,9 +1652,9 @@ def rename( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1720,7 +1676,7 @@ def rename( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - rename.metadata = {"url": "{url}/{containerName}"} + rename.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace def submit_batch( @@ -1757,23 +1713,18 @@ def submit_batch( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["batch"] = kwargs.pop("comp", _params.pop("comp", "batch")) - multipart_content_type: str = kwargs.pop( + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "batch")) # type: str + multipart_content_type = kwargs.pop( "multipart_content_type", _headers.pop("Content-Type", "application/xml") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + ) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Iterator[bytes]] _content = body @@ -1792,9 +1743,9 @@ def submit_batch( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=True, **kwargs ) @@ -1813,11 +1764,11 @@ def submit_batch( deserialized = response.stream_download(self._client._pipeline) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) - return deserialized # type: ignore + return deserialized - submit_batch.metadata = {"url": "{url}/{containerName}"} + submit_batch.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace def filter_blobs( @@ -1827,7 +1778,7 @@ def filter_blobs( where: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, _models.FilterBlobsIncludeItem]]] = None, + include: Optional[List[Union[str, "_models.FilterBlobsIncludeItem"]]] = None, **kwargs: Any ) -> _models.FilterBlobSegment: """The Filter Blobs operation enables callers to list blobs in a container whose tags match a @@ -1873,20 +1824,15 @@ def filter_blobs( :rtype: ~azure.storage.blob.models.FilterBlobSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["blobs"] = kwargs.pop("comp", _params.pop("comp", "blobs")) - cls: ClsType[_models.FilterBlobSegment] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "blobs")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.FilterBlobSegment] request = build_filter_blobs_request( url=self._config.url, @@ -1904,9 +1850,9 @@ def filter_blobs( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1932,7 +1878,7 @@ def filter_blobs( return deserialized - filter_blobs.metadata = {"url": "{url}/{containerName}"} + filter_blobs.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace def acquire_lease( # pylint: disable=inconsistent-return-statements @@ -1980,21 +1926,16 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -2019,9 +1960,9 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2046,7 +1987,7 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - acquire_lease.metadata = {"url": "{url}/{containerName}"} + acquire_lease.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace def release_lease( # pylint: disable=inconsistent-return-statements @@ -2087,21 +2028,16 @@ def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -2125,9 +2061,9 @@ def release_lease( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2151,7 +2087,7 @@ def release_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - release_lease.metadata = {"url": "{url}/{containerName}"} + release_lease.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace def renew_lease( # pylint: disable=inconsistent-return-statements @@ -2192,21 +2128,16 @@ def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -2230,9 +2161,9 @@ def renew_lease( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2257,7 +2188,7 @@ def renew_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - renew_lease.metadata = {"url": "{url}/{containerName}"} + renew_lease.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace def break_lease( # pylint: disable=inconsistent-return-statements @@ -2304,21 +2235,16 @@ def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -2342,9 +2268,9 @@ def break_lease( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2369,7 +2295,7 @@ def break_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - break_lease.metadata = {"url": "{url}/{containerName}"} + break_lease.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace def change_lease( # pylint: disable=inconsistent-return-statements @@ -2415,21 +2341,16 @@ def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "lease")) # type: str + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + action = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -2454,9 +2375,9 @@ def change_lease( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2481,7 +2402,7 @@ def change_lease( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - change_lease.metadata = {"url": "{url}/{containerName}"} + change_lease.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace def list_blob_flat_segment( @@ -2489,7 +2410,7 @@ def list_blob_flat_segment( prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, _models.ListBlobsIncludeItem]]] = None, + include: Optional[List[Union[str, "_models.ListBlobsIncludeItem"]]] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any @@ -2536,20 +2457,15 @@ def list_blob_flat_segment( :rtype: ~azure.storage.blob.models.ListBlobsFlatSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) - cls: ClsType[_models.ListBlobsFlatSegmentResponse] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "list")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ListBlobsFlatSegmentResponse] request = build_list_blob_flat_segment_request( url=self._config.url, @@ -2567,9 +2483,9 @@ def list_blob_flat_segment( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2596,7 +2512,7 @@ def list_blob_flat_segment( return deserialized - list_blob_flat_segment.metadata = {"url": "{url}/{containerName}"} + list_blob_flat_segment.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace def list_blob_hierarchy_segment( @@ -2605,7 +2521,7 @@ def list_blob_hierarchy_segment( prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, _models.ListBlobsIncludeItem]]] = None, + include: Optional[List[Union[str, "_models.ListBlobsIncludeItem"]]] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any @@ -2657,20 +2573,15 @@ def list_blob_hierarchy_segment( :rtype: ~azure.storage.blob.models.ListBlobsHierarchySegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) - cls: ClsType[_models.ListBlobsHierarchySegmentResponse] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "list")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ListBlobsHierarchySegmentResponse] request = build_list_blob_hierarchy_segment_request( url=self._config.url, @@ -2689,9 +2600,9 @@ def list_blob_hierarchy_segment( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2718,7 +2629,7 @@ def list_blob_hierarchy_segment( return deserialized - list_blob_hierarchy_segment.metadata = {"url": "{url}/{containerName}"} + list_blob_hierarchy_segment.metadata = {"url": "{url}/{containerName}"} # type: ignore @distributed_trace def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -2735,20 +2646,15 @@ def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account")) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "account")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_get_account_info_request( url=self._config.url, @@ -2760,9 +2666,9 @@ def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsiste params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2786,4 +2692,4 @@ def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsiste if cls: return cls(pipeline_response, None, response_headers) - get_account_info.metadata = {"url": "{url}/{containerName}"} + get_account_info.metadata = {"url": "{url}/{containerName}"} # type: ignore diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py index a212ba089831..ad6e0b2f3c8c 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py @@ -7,7 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -15,7 +14,6 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, - ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -28,10 +26,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +39,7 @@ def build_create_request( content_length: int, blob_content_length: int, timeout: Optional[int] = None, - tier: Optional[Union[str, _models.PremiumPageBlobAccessTier]] = None, + tier: Optional[Union[str, "_models.PremiumPageBlobAccessTier"]] = None, blob_content_type: Optional[str] = None, blob_content_encoding: Optional[str] = None, blob_content_language: Optional[str] = None, @@ -56,7 +50,7 @@ def build_create_request( blob_content_disposition: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, + encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, encryption_scope: Optional[str] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -67,15 +61,15 @@ def build_create_request( request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, + immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, legal_hold: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - blob_type: Literal["PageBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "PageBlob")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "PageBlob")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -84,7 +78,7 @@ def build_create_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters if timeout is not None: @@ -172,7 +166,7 @@ def build_upload_pages_request( lease_id: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, + encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, encryption_scope: Optional[str] = None, if_sequence_number_less_than_or_equal_to: Optional[int] = None, if_sequence_number_less_than: Optional[int] = None, @@ -188,10 +182,10 @@ def build_upload_pages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page")) - page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "page")) # type: str + page_write = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -200,7 +194,7 @@ def build_upload_pages_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -273,7 +267,7 @@ def build_clear_pages_request( lease_id: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, + encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, encryption_scope: Optional[str] = None, if_sequence_number_less_than_or_equal_to: Optional[int] = None, if_sequence_number_less_than: Optional[int] = None, @@ -289,9 +283,9 @@ def build_clear_pages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page")) - page_write: Literal["clear"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "clear")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "page")) # type: str + page_write = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "clear")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -300,7 +294,7 @@ def build_clear_pages_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -366,7 +360,7 @@ def build_upload_pages_from_url_request( timeout: Optional[int] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, + encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, encryption_scope: Optional[str] = None, lease_id: Optional[str] = None, if_sequence_number_less_than_or_equal_to: Optional[int] = None, @@ -388,9 +382,9 @@ def build_upload_pages_from_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page")) - page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "page")) # type: str + page_write = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -399,7 +393,7 @@ def build_upload_pages_from_url_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -496,8 +490,8 @@ def build_get_page_ranges_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["pagelist"] = kwargs.pop("comp", _params.pop("comp", "pagelist")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "pagelist")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -506,7 +500,7 @@ def build_get_page_ranges_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -564,8 +558,8 @@ def build_get_page_ranges_diff_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["pagelist"] = kwargs.pop("comp", _params.pop("comp", "pagelist")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "pagelist")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -574,7 +568,7 @@ def build_get_page_ranges_diff_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -622,7 +616,7 @@ def build_resize_request( lease_id: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_sha256: Optional[str] = None, - encryption_algorithm: Optional[Union[str, _models.EncryptionAlgorithmType]] = None, + encryption_algorithm: Optional[Union[str, "_models.EncryptionAlgorithmType"]] = None, encryption_scope: Optional[str] = None, if_modified_since: Optional[datetime.datetime] = None, if_unmodified_since: Optional[datetime.datetime] = None, @@ -635,8 +629,8 @@ def build_resize_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -645,7 +639,7 @@ def build_resize_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -687,7 +681,7 @@ def build_resize_request( def build_update_sequence_number_request( url: str, *, - sequence_number_action: Union[str, _models.SequenceNumberActionType], + sequence_number_action: Union[str, "_models.SequenceNumberActionType"], timeout: Optional[int] = None, lease_id: Optional[str] = None, if_modified_since: Optional[datetime.datetime] = None, @@ -702,8 +696,8 @@ def build_update_sequence_number_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -712,7 +706,7 @@ def build_update_sequence_number_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -761,8 +755,8 @@ def build_copy_incremental_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["incrementalcopy"] = kwargs.pop("comp", _params.pop("comp", "incrementalcopy")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "incrementalcopy")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -771,7 +765,7 @@ def build_copy_incremental_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -823,13 +817,13 @@ def create( # pylint: disable=inconsistent-return-statements content_length: int, blob_content_length: int, timeout: Optional[int] = None, - tier: Optional[Union[str, _models.PremiumPageBlobAccessTier]] = None, + tier: Optional[Union[str, "_models.PremiumPageBlobAccessTier"]] = None, metadata: Optional[Dict[str, str]] = None, blob_sequence_number: int = 0, request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, - immutability_policy_mode: Optional[Union[str, _models.BlobImmutabilityPolicyMode]] = None, + immutability_policy_mode: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] = None, legal_hold: Optional[bool] = None, blob_http_headers: Optional[_models.BlobHTTPHeaders] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, @@ -899,19 +893,14 @@ def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - blob_type: Literal["PageBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "PageBlob")) - cls: ClsType[None] = kwargs.pop("cls", None) + blob_type = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "PageBlob")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _blob_content_type = None _blob_content_encoding = None @@ -987,9 +976,9 @@ def create( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1024,7 +1013,7 @@ def create( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {"url": "{url}/{containerName}/{blob}"} + create.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def upload_pages( # pylint: disable=inconsistent-return-statements @@ -1095,21 +1084,16 @@ def upload_pages( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page")) - page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "page")) # type: str + page_write = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/octet-stream")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _encryption_key = None @@ -1177,9 +1161,9 @@ def upload_pages( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1219,7 +1203,7 @@ def upload_pages( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - upload_pages.metadata = {"url": "{url}/{containerName}/{blob}"} + upload_pages.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def clear_pages( # pylint: disable=inconsistent-return-statements @@ -1279,20 +1263,15 @@ def clear_pages( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page")) - page_write: Literal["clear"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "clear")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "page")) # type: str + page_write = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "clear")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _encryption_key = None @@ -1355,9 +1334,9 @@ def clear_pages( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1388,7 +1367,7 @@ def clear_pages( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - clear_pages.metadata = {"url": "{url}/{containerName}/{blob}"} + clear_pages.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def upload_pages_from_url( # pylint: disable=inconsistent-return-statements @@ -1473,20 +1452,15 @@ def upload_pages_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page")) - page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "page")) # type: str + page_write = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _encryption_key = None _encryption_key_sha256 = None @@ -1567,9 +1541,9 @@ def upload_pages_from_url( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1606,7 +1580,7 @@ def upload_pages_from_url( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - upload_pages_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} + upload_pages_from_url.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def get_page_ranges( @@ -1667,19 +1641,14 @@ def get_page_ranges( :rtype: ~azure.storage.blob.models.PageList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["pagelist"] = kwargs.pop("comp", _params.pop("comp", "pagelist")) - cls: ClsType[_models.PageList] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "pagelist")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PageList] _lease_id = None _if_modified_since = None @@ -1717,9 +1686,9 @@ def get_page_ranges( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1750,7 +1719,7 @@ def get_page_ranges( return deserialized - get_page_ranges.metadata = {"url": "{url}/{containerName}/{blob}"} + get_page_ranges.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def get_page_ranges_diff( @@ -1825,19 +1794,14 @@ def get_page_ranges_diff( :rtype: ~azure.storage.blob.models.PageList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["pagelist"] = kwargs.pop("comp", _params.pop("comp", "pagelist")) - cls: ClsType[_models.PageList] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "pagelist")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.PageList] _lease_id = None _if_modified_since = None @@ -1877,9 +1841,9 @@ def get_page_ranges_diff( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1910,7 +1874,7 @@ def get_page_ranges_diff( return deserialized - get_page_ranges_diff.metadata = {"url": "{url}/{containerName}/{blob}"} + get_page_ranges_diff.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def resize( # pylint: disable=inconsistent-return-statements @@ -1954,19 +1918,14 @@ def resize( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _encryption_key = None @@ -2015,9 +1974,9 @@ def resize( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2044,12 +2003,12 @@ def resize( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - resize.metadata = {"url": "{url}/{containerName}/{blob}"} + resize.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def update_sequence_number( # pylint: disable=inconsistent-return-statements self, - sequence_number_action: Union[str, _models.SequenceNumberActionType], + sequence_number_action: Union[str, "_models.SequenceNumberActionType"], timeout: Optional[int] = None, blob_sequence_number: int = 0, request_id_parameter: Optional[str] = None, @@ -2089,19 +2048,14 @@ def update_sequence_number( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _lease_id = None _if_modified_since = None @@ -2137,9 +2091,9 @@ def update_sequence_number( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2166,7 +2120,7 @@ def update_sequence_number( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - update_sequence_number.metadata = {"url": "{url}/{containerName}/{blob}"} + update_sequence_number.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore @distributed_trace def copy_incremental( # pylint: disable=inconsistent-return-statements @@ -2207,19 +2161,14 @@ def copy_incremental( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["incrementalcopy"] = kwargs.pop("comp", _params.pop("comp", "incrementalcopy")) - cls: ClsType[None] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "incrementalcopy")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _if_modified_since = None _if_unmodified_since = None @@ -2250,9 +2199,9 @@ def copy_incremental( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2278,4 +2227,4 @@ def copy_incremental( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - copy_incremental.metadata = {"url": "{url}/{containerName}/{blob}"} + copy_incremental.metadata = {"url": "{url}/{containerName}/{blob}"} # type: ignore diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py index d702b2c8cf0f..75e0f8a8f2f9 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterator, List, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -14,7 +13,6 @@ HttpResponseError, ResourceExistsError, ResourceNotFoundError, - ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse @@ -27,10 +25,6 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,10 +38,10 @@ def build_set_properties_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -56,7 +50,7 @@ def build_set_properties_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -81,9 +75,9 @@ def build_get_properties_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -92,7 +86,7 @@ def build_get_properties_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -115,9 +109,9 @@ def build_get_statistics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) - comp: Literal["stats"] = kwargs.pop("comp", _params.pop("comp", "stats")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "stats")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -126,7 +120,7 @@ def build_get_statistics_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -149,7 +143,7 @@ def build_list_containers_segment_request( prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, _models.ListContainersIncludeType]]] = None, + include: Optional[List[Union[str, "_models.ListContainersIncludeType"]]] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any @@ -157,8 +151,8 @@ def build_list_containers_segment_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "list")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -167,7 +161,7 @@ def build_list_containers_segment_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -197,10 +191,10 @@ def build_get_user_delegation_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) - comp: Literal["userdelegationkey"] = kwargs.pop("comp", _params.pop("comp", "userdelegationkey")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "userdelegationkey")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -209,7 +203,7 @@ def build_get_user_delegation_key_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -232,9 +226,9 @@ def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account")) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + restype = kwargs.pop("restype", _params.pop("restype", "account")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -243,7 +237,7 @@ def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") @@ -268,9 +262,11 @@ def build_submit_batch_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["batch"] = kwargs.pop("comp", _params.pop("comp", "batch")) - multipart_content_type: Optional[str] = kwargs.pop("multipart_content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "batch")) # type: str + multipart_content_type = kwargs.pop( + "multipart_content_type", _headers.pop("Content-Type", None) + ) # type: Optional[str] + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -279,7 +275,7 @@ def build_submit_batch_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -306,14 +302,14 @@ def build_filter_blobs_request( where: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, _models.FilterBlobsIncludeItem]]] = None, + include: Optional[List[Union[str, "_models.FilterBlobsIncludeItem"]]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["blobs"] = kwargs.pop("comp", _params.pop("comp", "blobs")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + comp = kwargs.pop("comp", _params.pop("comp", "blobs")) # type: str + version = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) # type: str accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -322,7 +318,7 @@ def build_filter_blobs_request( "url": _SERIALIZER.url("url", url, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters _params["comp"] = _SERIALIZER.query("comp", comp, "str") @@ -398,21 +394,16 @@ def set_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] _content = self._serialize.body(storage_service_properties, "StorageServiceProperties", is_xml=True) @@ -430,9 +421,9 @@ def set_properties( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -453,7 +444,7 @@ def set_properties( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - set_properties.metadata = {"url": "{url}"} + set_properties.metadata = {"url": "{url}"} # type: ignore @distributed_trace def get_properties( @@ -482,20 +473,15 @@ def get_properties( :rtype: ~azure.storage.blob.models.StorageServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - cls: ClsType[_models.StorageServiceProperties] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageServiceProperties] request = build_get_properties_request( url=self._config.url, @@ -509,9 +495,9 @@ def get_properties( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -536,7 +522,7 @@ def get_properties( return deserialized - get_properties.metadata = {"url": "{url}"} + get_properties.metadata = {"url": "{url}"} # type: ignore @distributed_trace def get_statistics( @@ -566,20 +552,15 @@ def get_statistics( :rtype: ~azure.storage.blob.models.StorageServiceStats :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) - comp: Literal["stats"] = kwargs.pop("comp", _params.pop("comp", "stats")) - cls: ClsType[_models.StorageServiceStats] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "stats")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.StorageServiceStats] request = build_get_statistics_request( url=self._config.url, @@ -593,9 +574,9 @@ def get_statistics( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -621,7 +602,7 @@ def get_statistics( return deserialized - get_statistics.metadata = {"url": "{url}"} + get_statistics.metadata = {"url": "{url}"} # type: ignore @distributed_trace def list_containers_segment( @@ -629,7 +610,7 @@ def list_containers_segment( prefix: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, _models.ListContainersIncludeType]]] = None, + include: Optional[List[Union[str, "_models.ListContainersIncludeType"]]] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any @@ -674,19 +655,14 @@ def list_containers_segment( :rtype: ~azure.storage.blob.models.ListContainersSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) - cls: ClsType[_models.ListContainersSegmentResponse] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "list")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.ListContainersSegmentResponse] request = build_list_containers_segment_request( url=self._config.url, @@ -703,9 +679,9 @@ def list_containers_segment( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -730,7 +706,7 @@ def list_containers_segment( return deserialized - list_containers_segment.metadata = {"url": "{url}"} + list_containers_segment.metadata = {"url": "{url}"} # type: ignore @distributed_trace def get_user_delegation_key( @@ -765,21 +741,16 @@ def get_user_delegation_key( :rtype: ~azure.storage.blob.models.UserDelegationKey :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) - comp: Literal["userdelegationkey"] = kwargs.pop("comp", _params.pop("comp", "userdelegationkey")) - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) - cls: ClsType[_models.UserDelegationKey] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "userdelegationkey")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/xml")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.UserDelegationKey] _content = self._serialize.body(key_info, "KeyInfo", is_xml=True) @@ -797,9 +768,9 @@ def get_user_delegation_key( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -825,7 +796,7 @@ def get_user_delegation_key( return deserialized - get_user_delegation_key.metadata = {"url": "{url}"} + get_user_delegation_key.metadata = {"url": "{url}"} # type: ignore @distributed_trace def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -842,20 +813,15 @@ def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account")) - comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - cls: ClsType[None] = kwargs.pop("cls", None) + restype = kwargs.pop("restype", _params.pop("restype", "account")) # type: str + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_get_account_info_request( url=self._config.url, @@ -867,9 +833,9 @@ def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsiste params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -894,7 +860,7 @@ def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsiste if cls: return cls(pipeline_response, None, response_headers) - get_account_info.metadata = {"url": "{url}"} + get_account_info.metadata = {"url": "{url}"} # type: ignore @distributed_trace def submit_batch( @@ -928,22 +894,17 @@ def submit_batch( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["batch"] = kwargs.pop("comp", _params.pop("comp", "batch")) - multipart_content_type: str = kwargs.pop( + comp = kwargs.pop("comp", _params.pop("comp", "batch")) # type: str + multipart_content_type = kwargs.pop( "multipart_content_type", _headers.pop("Content-Type", "application/xml") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + ) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[Iterator[bytes]] _content = body @@ -961,9 +922,9 @@ def submit_batch( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=True, **kwargs ) @@ -982,11 +943,11 @@ def submit_batch( deserialized = response.stream_download(self._client._pipeline) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) - return deserialized # type: ignore + return deserialized - submit_batch.metadata = {"url": "{url}"} + submit_batch.metadata = {"url": "{url}"} # type: ignore @distributed_trace def filter_blobs( @@ -996,7 +957,7 @@ def filter_blobs( where: Optional[str] = None, marker: Optional[str] = None, maxresults: Optional[int] = None, - include: Optional[List[Union[str, _models.FilterBlobsIncludeItem]]] = None, + include: Optional[List[Union[str, "_models.FilterBlobsIncludeItem"]]] = None, **kwargs: Any ) -> _models.FilterBlobSegment: """The Filter Blobs operation enables callers to list blobs across all containers whose tags match @@ -1040,19 +1001,14 @@ def filter_blobs( :rtype: ~azure.storage.blob.models.FilterBlobSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } + error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp: Literal["blobs"] = kwargs.pop("comp", _params.pop("comp", "blobs")) - cls: ClsType[_models.FilterBlobSegment] = kwargs.pop("cls", None) + comp = kwargs.pop("comp", _params.pop("comp", "blobs")) # type: str + cls = kwargs.pop("cls", None) # type: ClsType[_models.FilterBlobSegment] request = build_filter_blobs_request( url=self._config.url, @@ -1069,9 +1025,9 @@ def filter_blobs( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1097,4 +1053,4 @@ def filter_blobs( return deserialized - filter_blobs.metadata = {"url": "{url}"} + filter_blobs.metadata = {"url": "{url}"} # type: ignore From 9dcec157d009ac69a8de94e18f697db656744df7 Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Thu, 16 Feb 2023 16:12:38 -0800 Subject: [PATCH 4/5] Add test --- ...obtest_create_blob_with_question_mark.json | 58 +++++++++---------- ...nctest_create_blob_with_question_mark.json | 58 +++++++++---------- .../tests/test_common_blob.py | 1 + .../tests/test_common_blob_async.py | 1 + 4 files changed, 60 insertions(+), 58 deletions(-) diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob.pyTestStorageCommonBlobtest_create_blob_with_question_mark.json b/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob.pyTestStorageCommonBlobtest_create_blob_with_question_mark.json index 1d7b3144778c..4eab88ab2e71 100644 --- a/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob.pyTestStorageCommonBlobtest_create_blob_with_question_mark.json +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob.pyTestStorageCommonBlobtest_create_blob_with_question_mark.json @@ -8,22 +8,22 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-storage-blob/12.14.0b1 Python/3.10.5 (Windows-10-10.0.22000-SP0)", - "x-ms-date": "Fri, 12 Aug 2022 20:48:55 GMT", - "x-ms-version": "2021-08-06" + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:12:22 GMT", + "x-ms-version": "2021-12-02" }, "RequestBody": null, "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", - "Date": "Fri, 12 Aug 2022 20:48:54 GMT", - "ETag": "\u00220x8DA7CA412737768\u0022", - "Last-Modified": "Fri, 12 Aug 2022 20:48:55 GMT", + "Date": "Fri, 17 Feb 2023 00:12:20 GMT", + "ETag": "\u00220x8DB107BA32E3B98\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:12:20 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-version": "2021-08-06" + "x-ms-version": "2021-12-02" }, "ResponseBody": null }, @@ -35,22 +35,22 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-storage-blob/12.14.0b1 Python/3.10.5 (Windows-10-10.0.22000-SP0)", - "x-ms-date": "Fri, 12 Aug 2022 20:48:55 GMT", - "x-ms-version": "2021-08-06" + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:12:23 GMT", + "x-ms-version": "2021-12-02" }, "RequestBody": null, "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", - "Date": "Fri, 12 Aug 2022 20:48:54 GMT", - "ETag": "\u00220x8DA7CA4127D8805\u0022", - "Last-Modified": "Fri, 12 Aug 2022 20:48:55 GMT", + "Date": "Fri, 17 Feb 2023 00:12:20 GMT", + "ETag": "\u00220x8DB107BA343215D\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:12:20 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-version": "2021-08-06" + "x-ms-version": "2021-12-02" }, "ResponseBody": null }, @@ -64,26 +64,26 @@ "Content-Length": "3", "Content-Type": "application/octet-stream", "If-None-Match": "*", - "User-Agent": "azsdk-python-storage-blob/12.14.0b1 Python/3.10.5 (Windows-10-10.0.22000-SP0)", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", "x-ms-blob-type": "BlockBlob", - "x-ms-date": "Fri, 12 Aug 2022 20:48:55 GMT", - "x-ms-version": "2021-08-06" + "x-ms-date": "Fri, 17 Feb 2023 00:12:23 GMT", + "x-ms-version": "2021-12-02" }, "RequestBody": "Pz8/", "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", "Content-MD5": "DRsIw0hYkhvHxmKyKKy3ug==", - "Date": "Fri, 12 Aug 2022 20:48:54 GMT", - "ETag": "\u00220x8DA7CA412883577\u0022", - "Last-Modified": "Fri, 12 Aug 2022 20:48:55 GMT", + "Date": "Fri, 17 Feb 2023 00:12:20 GMT", + "ETag": "\u00220x8DB107BA353B115\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:12:21 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" ], "x-ms-content-crc64": "VtoDJyOMw/A=", "x-ms-request-server-encrypted": "true", - "x-ms-version": "2021-08-06" + "x-ms-version": "2021-12-02" }, "ResponseBody": null }, @@ -94,10 +94,10 @@ "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-storage-blob/12.14.0b1 Python/3.10.5 (Windows-10-10.0.22000-SP0)", - "x-ms-date": "Fri, 12 Aug 2022 20:48:55 GMT", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:12:23 GMT", "x-ms-range": "bytes=0-33554431", - "x-ms-version": "2021-08-06" + "x-ms-version": "2021-12-02" }, "RequestBody": null, "StatusCode": 206, @@ -106,9 +106,9 @@ "Content-Length": "3", "Content-Range": "bytes 0-2/3", "Content-Type": "application/octet-stream", - "Date": "Fri, 12 Aug 2022 20:48:55 GMT", - "ETag": "\u00220x8DA7CA412883577\u0022", - "Last-Modified": "Fri, 12 Aug 2022 20:48:55 GMT", + "Date": "Fri, 17 Feb 2023 00:12:20 GMT", + "ETag": "\u00220x8DB107BA353B115\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:12:21 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" @@ -116,11 +116,11 @@ "Vary": "Origin", "x-ms-blob-content-md5": "DRsIw0hYkhvHxmKyKKy3ug==", "x-ms-blob-type": "BlockBlob", - "x-ms-creation-time": "Fri, 12 Aug 2022 20:48:55 GMT", + "x-ms-creation-time": "Fri, 17 Feb 2023 00:12:21 GMT", "x-ms-lease-state": "available", "x-ms-lease-status": "unlocked", "x-ms-server-encrypted": "true", - "x-ms-version": "2021-08-06" + "x-ms-version": "2021-12-02" }, "ResponseBody": "Pz8/" } diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob_async.pyTestStorageCommonBlobAsynctest_create_blob_with_question_mark.json b/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob_async.pyTestStorageCommonBlobAsynctest_create_blob_with_question_mark.json index 44d62b475031..eaa221a8cc9f 100644 --- a/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob_async.pyTestStorageCommonBlobAsynctest_create_blob_with_question_mark.json +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob_async.pyTestStorageCommonBlobAsynctest_create_blob_with_question_mark.json @@ -7,22 +7,22 @@ "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", "Content-Length": "0", - "User-Agent": "azsdk-python-storage-blob/12.14.0b1 Python/3.10.5 (Windows-10-10.0.22000-SP0)", - "x-ms-date": "Fri, 12 Aug 2022 23:35:24 GMT", - "x-ms-version": "2021-08-06" + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:12:01 GMT", + "x-ms-version": "2021-12-02" }, "RequestBody": null, "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", - "Date": "Fri, 12 Aug 2022 23:35:24 GMT", - "ETag": "\u00220x8DA7CBB54A33CD6\u0022", - "Last-Modified": "Fri, 12 Aug 2022 23:35:24 GMT", + "Date": "Fri, 17 Feb 2023 00:11:59 GMT", + "ETag": "\u00220x8DB107B967EAE61\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:11:59 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-version": "2021-08-06" + "x-ms-version": "2021-12-02" }, "ResponseBody": null }, @@ -33,22 +33,22 @@ "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", "Content-Length": "0", - "User-Agent": "azsdk-python-storage-blob/12.14.0b1 Python/3.10.5 (Windows-10-10.0.22000-SP0)", - "x-ms-date": "Fri, 12 Aug 2022 23:35:24 GMT", - "x-ms-version": "2021-08-06" + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:12:02 GMT", + "x-ms-version": "2021-12-02" }, "RequestBody": null, "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", - "Date": "Fri, 12 Aug 2022 23:35:24 GMT", - "ETag": "\u00220x8DA7CBB54B4033B\u0022", - "Last-Modified": "Fri, 12 Aug 2022 23:35:24 GMT", + "Date": "Fri, 17 Feb 2023 00:11:59 GMT", + "ETag": "\u00220x8DB107B9692D0E2\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:11:59 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-version": "2021-08-06" + "x-ms-version": "2021-12-02" }, "ResponseBody": null }, @@ -61,26 +61,26 @@ "Content-Length": "3", "Content-Type": "application/octet-stream", "If-None-Match": "*", - "User-Agent": "azsdk-python-storage-blob/12.14.0b1 Python/3.10.5 (Windows-10-10.0.22000-SP0)", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", "x-ms-blob-type": "BlockBlob", - "x-ms-date": "Fri, 12 Aug 2022 23:35:24 GMT", - "x-ms-version": "2021-08-06" + "x-ms-date": "Fri, 17 Feb 2023 00:12:02 GMT", + "x-ms-version": "2021-12-02" }, "RequestBody": "Pz8/", "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", "Content-MD5": "DRsIw0hYkhvHxmKyKKy3ug==", - "Date": "Fri, 12 Aug 2022 23:35:24 GMT", - "ETag": "\u00220x8DA7CBB54BFFF62\u0022", - "Last-Modified": "Fri, 12 Aug 2022 23:35:24 GMT", + "Date": "Fri, 17 Feb 2023 00:11:59 GMT", + "ETag": "\u00220x8DB107B96A81C4A\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:11:59 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" ], "x-ms-content-crc64": "VtoDJyOMw/A=", "x-ms-request-server-encrypted": "true", - "x-ms-version": "2021-08-06" + "x-ms-version": "2021-12-02" }, "ResponseBody": null }, @@ -90,10 +90,10 @@ "RequestHeaders": { "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", - "User-Agent": "azsdk-python-storage-blob/12.14.0b1 Python/3.10.5 (Windows-10-10.0.22000-SP0)", - "x-ms-date": "Fri, 12 Aug 2022 23:35:25 GMT", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:12:02 GMT", "x-ms-range": "bytes=0-33554431", - "x-ms-version": "2021-08-06" + "x-ms-version": "2021-12-02" }, "RequestBody": null, "StatusCode": 206, @@ -102,9 +102,9 @@ "Content-Length": "3", "Content-Range": "bytes 0-2/3", "Content-Type": "application/octet-stream", - "Date": "Fri, 12 Aug 2022 23:35:24 GMT", - "ETag": "\u00220x8DA7CBB54BFFF62\u0022", - "Last-Modified": "Fri, 12 Aug 2022 23:35:24 GMT", + "Date": "Fri, 17 Feb 2023 00:11:59 GMT", + "ETag": "\u00220x8DB107B96A81C4A\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:11:59 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" @@ -112,11 +112,11 @@ "Vary": "Origin", "x-ms-blob-content-md5": "DRsIw0hYkhvHxmKyKKy3ug==", "x-ms-blob-type": "BlockBlob", - "x-ms-creation-time": "Fri, 12 Aug 2022 23:35:24 GMT", + "x-ms-creation-time": "Fri, 17 Feb 2023 00:11:59 GMT", "x-ms-lease-state": "available", "x-ms-lease-status": "unlocked", "x-ms-server-encrypted": "true", - "x-ms-version": "2021-08-06" + "x-ms-version": "2021-12-02" }, "ResponseBody": "Pz8/" } diff --git a/sdk/storage/azure-storage-blob/tests/test_common_blob.py b/sdk/storage/azure-storage-blob/tests/test_common_blob.py index 8f7aac93f256..c723f24b003a 100644 --- a/sdk/storage/azure-storage-blob/tests/test_common_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_common_blob.py @@ -281,6 +281,7 @@ def test_create_blob_with_question_mark(self, **kwargs): data = blob.download_blob(encoding='utf-8') assert data is not None assert data.readall() == blob_data + assert data.properties['creation_time'] is not None @BlobPreparer() @recorded_by_proxy diff --git a/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py index a4665ad35731..507bec2bd42f 100644 --- a/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py @@ -507,6 +507,7 @@ async def test_create_blob_with_question_mark(self, **kwargs): data = await stream.readall() assert data is not None assert data == blob_data + assert stream.properties['creation_time'] is not None @BlobPreparer() @recorded_by_proxy_async From 6387b2688af1d9812450660938cb96ea4e6f8169 Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Thu, 16 Feb 2023 16:34:41 -0800 Subject: [PATCH 5/5] Fix tests --- ...obtest_create_blob_with_question_mark.json | 34 ++--- ...ageCommonBlobtest_download_properties.json | 129 ++++++++++++++++++ ...nctest_create_blob_with_question_mark.json | 44 +++--- ...mmonBlobAsynctest_download_properties.json | 125 +++++++++++++++++ .../tests/test_common_blob.py | 29 +++- .../tests/test_common_blob_async.py | 27 +++- 6 files changed, 348 insertions(+), 40 deletions(-) create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_common_blob.pyTestStorageCommonBlobtest_download_properties.json create mode 100644 sdk/storage/azure-storage-blob/tests/recordings/test_common_blob_async.pyTestStorageCommonBlobAsynctest_download_properties.json diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob.pyTestStorageCommonBlobtest_create_blob_with_question_mark.json b/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob.pyTestStorageCommonBlobtest_create_blob_with_question_mark.json index 4eab88ab2e71..8306c5b95b4d 100644 --- a/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob.pyTestStorageCommonBlobtest_create_blob_with_question_mark.json +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob.pyTestStorageCommonBlobtest_create_blob_with_question_mark.json @@ -9,16 +9,16 @@ "Connection": "keep-alive", "Content-Length": "0", "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", - "x-ms-date": "Fri, 17 Feb 2023 00:12:22 GMT", + "x-ms-date": "Fri, 17 Feb 2023 00:16:21 GMT", "x-ms-version": "2021-12-02" }, "RequestBody": null, "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", - "Date": "Fri, 17 Feb 2023 00:12:20 GMT", - "ETag": "\u00220x8DB107BA32E3B98\u0022", - "Last-Modified": "Fri, 17 Feb 2023 00:12:20 GMT", + "Date": "Fri, 17 Feb 2023 00:16:19 GMT", + "ETag": "\u00220x8DB107C31A2EEC1\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:16:19 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" @@ -36,16 +36,16 @@ "Connection": "keep-alive", "Content-Length": "0", "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", - "x-ms-date": "Fri, 17 Feb 2023 00:12:23 GMT", + "x-ms-date": "Fri, 17 Feb 2023 00:16:22 GMT", "x-ms-version": "2021-12-02" }, "RequestBody": null, "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", - "Date": "Fri, 17 Feb 2023 00:12:20 GMT", - "ETag": "\u00220x8DB107BA343215D\u0022", - "Last-Modified": "Fri, 17 Feb 2023 00:12:20 GMT", + "Date": "Fri, 17 Feb 2023 00:16:19 GMT", + "ETag": "\u00220x8DB107C31B38F29\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:16:19 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" @@ -66,7 +66,7 @@ "If-None-Match": "*", "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", "x-ms-blob-type": "BlockBlob", - "x-ms-date": "Fri, 17 Feb 2023 00:12:23 GMT", + "x-ms-date": "Fri, 17 Feb 2023 00:16:22 GMT", "x-ms-version": "2021-12-02" }, "RequestBody": "Pz8/", @@ -74,9 +74,9 @@ "ResponseHeaders": { "Content-Length": "0", "Content-MD5": "DRsIw0hYkhvHxmKyKKy3ug==", - "Date": "Fri, 17 Feb 2023 00:12:20 GMT", - "ETag": "\u00220x8DB107BA353B115\u0022", - "Last-Modified": "Fri, 17 Feb 2023 00:12:21 GMT", + "Date": "Fri, 17 Feb 2023 00:16:19 GMT", + "ETag": "\u00220x8DB107C31C34670\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:16:19 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" @@ -95,7 +95,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", - "x-ms-date": "Fri, 17 Feb 2023 00:12:23 GMT", + "x-ms-date": "Fri, 17 Feb 2023 00:16:22 GMT", "x-ms-range": "bytes=0-33554431", "x-ms-version": "2021-12-02" }, @@ -106,9 +106,9 @@ "Content-Length": "3", "Content-Range": "bytes 0-2/3", "Content-Type": "application/octet-stream", - "Date": "Fri, 17 Feb 2023 00:12:20 GMT", - "ETag": "\u00220x8DB107BA353B115\u0022", - "Last-Modified": "Fri, 17 Feb 2023 00:12:21 GMT", + "Date": "Fri, 17 Feb 2023 00:16:19 GMT", + "ETag": "\u00220x8DB107C31C34670\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:16:19 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" @@ -116,7 +116,7 @@ "Vary": "Origin", "x-ms-blob-content-md5": "DRsIw0hYkhvHxmKyKKy3ug==", "x-ms-blob-type": "BlockBlob", - "x-ms-creation-time": "Fri, 17 Feb 2023 00:12:21 GMT", + "x-ms-creation-time": "Fri, 17 Feb 2023 00:16:19 GMT", "x-ms-lease-state": "available", "x-ms-lease-status": "unlocked", "x-ms-server-encrypted": "true", diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob.pyTestStorageCommonBlobtest_download_properties.json b/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob.pyTestStorageCommonBlobtest_download_properties.json new file mode 100644 index 000000000000..2bc60ceea621 --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob.pyTestStorageCommonBlobtest_download_properties.json @@ -0,0 +1,129 @@ +{ + "Entries": [ + { + "RequestUri": "https://storagename.blob.core.windows.net/utcontainera3942b6e?restype=container\u0026timeout=5", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:32:26 GMT", + "x-ms-version": "2021-12-02" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Fri, 17 Feb 2023 00:32:24 GMT", + "ETag": "\u00220x8DB107E70E48ABB\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:32:24 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-version": "2021-12-02" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://storagename.blob.core.windows.net/utcontainersourcea3942b6e?restype=container\u0026timeout=5", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:32:27 GMT", + "x-ms-version": "2021-12-02" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Fri, 17 Feb 2023 00:32:24 GMT", + "ETag": "\u00220x8DB107E70F440E1\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:32:25 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-version": "2021-12-02" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://storagename.blob.core.windows.net/utcontainera3942b6e/utcontainera3942b6e", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "3", + "Content-Type": "application/octet-stream", + "If-None-Match": "*", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-blob-type": "BlockBlob", + "x-ms-date": "Fri, 17 Feb 2023 00:32:27 GMT", + "x-ms-version": "2021-12-02" + }, + "RequestBody": "YWJj", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Content-MD5": "kAFQmDzST7DWlj99KOF/cg==", + "Date": "Fri, 17 Feb 2023 00:32:24 GMT", + "ETag": "\u00220x8DB107E710645CB\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:32:25 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-content-crc64": "6/rBP7vK5QU=", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2021-12-02" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://storagename.blob.core.windows.net/utcontainera3942b6e/utcontainera3942b6e", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:32:27 GMT", + "x-ms-range": "bytes=0-33554431", + "x-ms-version": "2021-12-02" + }, + "RequestBody": null, + "StatusCode": 206, + "ResponseHeaders": { + "Accept-Ranges": "bytes", + "Content-Length": "3", + "Content-Range": "bytes 0-2/3", + "Content-Type": "application/octet-stream", + "Date": "Fri, 17 Feb 2023 00:32:24 GMT", + "ETag": "\u00220x8DB107E710645CB\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:32:25 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Vary": "Origin", + "x-ms-blob-content-md5": "kAFQmDzST7DWlj99KOF/cg==", + "x-ms-blob-type": "BlockBlob", + "x-ms-creation-time": "Fri, 17 Feb 2023 00:32:25 GMT", + "x-ms-lease-state": "available", + "x-ms-lease-status": "unlocked", + "x-ms-server-encrypted": "true", + "x-ms-version": "2021-12-02" + }, + "ResponseBody": "YWJj" + } + ], + "Variables": {} +} diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob_async.pyTestStorageCommonBlobAsynctest_create_blob_with_question_mark.json b/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob_async.pyTestStorageCommonBlobAsynctest_create_blob_with_question_mark.json index eaa221a8cc9f..d2dbd0bc6427 100644 --- a/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob_async.pyTestStorageCommonBlobAsynctest_create_blob_with_question_mark.json +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob_async.pyTestStorageCommonBlobAsynctest_create_blob_with_question_mark.json @@ -8,16 +8,16 @@ "Accept-Encoding": "gzip, deflate", "Content-Length": "0", "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", - "x-ms-date": "Fri, 17 Feb 2023 00:12:01 GMT", + "x-ms-date": "Fri, 17 Feb 2023 00:15:55 GMT", "x-ms-version": "2021-12-02" }, "RequestBody": null, "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", - "Date": "Fri, 17 Feb 2023 00:11:59 GMT", - "ETag": "\u00220x8DB107B967EAE61\u0022", - "Last-Modified": "Fri, 17 Feb 2023 00:11:59 GMT", + "Date": "Fri, 17 Feb 2023 00:15:54 GMT", + "ETag": "\u00220x8DB107C22508DD9\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:15:54 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" @@ -34,23 +34,27 @@ "Accept-Encoding": "gzip, deflate", "Content-Length": "0", "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", - "x-ms-date": "Fri, 17 Feb 2023 00:12:02 GMT", + "x-ms-date": "Fri, 17 Feb 2023 00:15:56 GMT", "x-ms-version": "2021-12-02" }, "RequestBody": null, - "StatusCode": 201, + "StatusCode": 409, "ResponseHeaders": { - "Content-Length": "0", - "Date": "Fri, 17 Feb 2023 00:11:59 GMT", - "ETag": "\u00220x8DB107B9692D0E2\u0022", - "Last-Modified": "Fri, 17 Feb 2023 00:11:59 GMT", + "Content-Length": "252", + "Content-Type": "application/xml", + "Date": "Fri, 17 Feb 2023 00:15:54 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" ], + "x-ms-error-code": "ContainerBeingDeleted", "x-ms-version": "2021-12-02" }, - "ResponseBody": null + "ResponseBody": [ + "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CError\u003E\u003CCode\u003EContainerBeingDeleted\u003C/Code\u003E\u003CMessage\u003EThe specified container is being deleted. Try operation later.\n", + "RequestId:d6e02e0e-a01e-00b6-4464-428457000000\n", + "Time:2023-02-17T00:15:54.1990411Z\u003C/Message\u003E\u003C/Error\u003E" + ] }, { "RequestUri": "https://storagename.blob.core.windows.net/utcontainerd8ce3453/%3Fques%3Ftion%3F", @@ -63,7 +67,7 @@ "If-None-Match": "*", "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", "x-ms-blob-type": "BlockBlob", - "x-ms-date": "Fri, 17 Feb 2023 00:12:02 GMT", + "x-ms-date": "Fri, 17 Feb 2023 00:15:56 GMT", "x-ms-version": "2021-12-02" }, "RequestBody": "Pz8/", @@ -71,9 +75,9 @@ "ResponseHeaders": { "Content-Length": "0", "Content-MD5": "DRsIw0hYkhvHxmKyKKy3ug==", - "Date": "Fri, 17 Feb 2023 00:11:59 GMT", - "ETag": "\u00220x8DB107B96A81C4A\u0022", - "Last-Modified": "Fri, 17 Feb 2023 00:11:59 GMT", + "Date": "Fri, 17 Feb 2023 00:15:54 GMT", + "ETag": "\u00220x8DB107C2275EECD\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:15:54 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" @@ -91,7 +95,7 @@ "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", - "x-ms-date": "Fri, 17 Feb 2023 00:12:02 GMT", + "x-ms-date": "Fri, 17 Feb 2023 00:15:56 GMT", "x-ms-range": "bytes=0-33554431", "x-ms-version": "2021-12-02" }, @@ -102,9 +106,9 @@ "Content-Length": "3", "Content-Range": "bytes 0-2/3", "Content-Type": "application/octet-stream", - "Date": "Fri, 17 Feb 2023 00:11:59 GMT", - "ETag": "\u00220x8DB107B96A81C4A\u0022", - "Last-Modified": "Fri, 17 Feb 2023 00:11:59 GMT", + "Date": "Fri, 17 Feb 2023 00:15:54 GMT", + "ETag": "\u00220x8DB107C2275EECD\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:15:54 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" @@ -112,7 +116,7 @@ "Vary": "Origin", "x-ms-blob-content-md5": "DRsIw0hYkhvHxmKyKKy3ug==", "x-ms-blob-type": "BlockBlob", - "x-ms-creation-time": "Fri, 17 Feb 2023 00:11:59 GMT", + "x-ms-creation-time": "Fri, 17 Feb 2023 00:15:54 GMT", "x-ms-lease-state": "available", "x-ms-lease-status": "unlocked", "x-ms-server-encrypted": "true", diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob_async.pyTestStorageCommonBlobAsynctest_download_properties.json b/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob_async.pyTestStorageCommonBlobAsynctest_download_properties.json new file mode 100644 index 000000000000..a21b82b66eed --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob_async.pyTestStorageCommonBlobAsynctest_download_properties.json @@ -0,0 +1,125 @@ +{ + "Entries": [ + { + "RequestUri": "https://storagename.blob.core.windows.net/utcontaineraa3e2fe9?restype=container", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Content-Length": "0", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:33:53 GMT", + "x-ms-version": "2021-12-02" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Fri, 17 Feb 2023 00:33:50 GMT", + "ETag": "\u00220x8DB107EA47292C6\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:33:51 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-version": "2021-12-02" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://storagename.blob.core.windows.net/utcontainersourceaa3e2fe9?restype=container", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Content-Length": "0", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:33:53 GMT", + "x-ms-version": "2021-12-02" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Fri, 17 Feb 2023 00:33:50 GMT", + "ETag": "\u00220x8DB107EA491B0DF\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:33:51 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-version": "2021-12-02" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://storagename.blob.core.windows.net/utcontaineraa3e2fe9/utcontaineraa3e2fe9", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Content-Length": "3", + "Content-Type": "application/octet-stream", + "If-None-Match": "*", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-blob-type": "BlockBlob", + "x-ms-date": "Fri, 17 Feb 2023 00:33:54 GMT", + "x-ms-version": "2021-12-02" + }, + "RequestBody": "YWJj", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Content-MD5": "kAFQmDzST7DWlj99KOF/cg==", + "Date": "Fri, 17 Feb 2023 00:33:51 GMT", + "ETag": "\u00220x8DB107EA4A5730C\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:33:51 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-content-crc64": "6/rBP7vK5QU=", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2021-12-02" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://storagename.blob.core.windows.net/utcontaineraa3e2fe9/utcontaineraa3e2fe9", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:33:54 GMT", + "x-ms-range": "bytes=0-33554431", + "x-ms-version": "2021-12-02" + }, + "RequestBody": null, + "StatusCode": 206, + "ResponseHeaders": { + "Accept-Ranges": "bytes", + "Content-Length": "3", + "Content-Range": "bytes 0-2/3", + "Content-Type": "application/octet-stream", + "Date": "Fri, 17 Feb 2023 00:33:51 GMT", + "ETag": "\u00220x8DB107EA4A5730C\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:33:51 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Vary": "Origin", + "x-ms-blob-content-md5": "kAFQmDzST7DWlj99KOF/cg==", + "x-ms-blob-type": "BlockBlob", + "x-ms-creation-time": "Fri, 17 Feb 2023 00:33:51 GMT", + "x-ms-lease-state": "available", + "x-ms-lease-status": "unlocked", + "x-ms-server-encrypted": "true", + "x-ms-version": "2021-12-02" + }, + "ResponseBody": "YWJj" + } + ], + "Variables": {} +} diff --git a/sdk/storage/azure-storage-blob/tests/test_common_blob.py b/sdk/storage/azure-storage-blob/tests/test_common_blob.py index c723f24b003a..6efee9014da8 100644 --- a/sdk/storage/azure-storage-blob/tests/test_common_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_common_blob.py @@ -281,7 +281,6 @@ def test_create_blob_with_question_mark(self, **kwargs): data = blob.download_blob(encoding='utf-8') assert data is not None assert data.readall() == blob_data - assert data.properties['creation_time'] is not None @BlobPreparer() @recorded_by_proxy @@ -3258,4 +3257,30 @@ def test_validate_empty_blob(self, **kwargs): assert blob_client.exists() assert blob_client.get_blob_properties().size == 0 -# ------------------------------------------------------------------------------ + @BlobPreparer() + @recorded_by_proxy + def test_download_properties(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + self._setup(storage_account_name, storage_account_key) + + blob_name = self.get_resource_name("utcontainer") + blob_data = 'abc' + + # Act + blob = self.bsc.get_blob_client(self.container_name, blob_name) + blob.upload_blob(blob_data) + + # Assert + data = blob.download_blob(encoding='utf-8') + props = data.properties + + assert data is not None + assert data.readall() == blob_data + assert props['name'] == blob_name + assert props['creation_time'] is not None + assert props['content_settings'] is not None + assert props['size'] == len(blob_data) + + # ------------------------------------------------------------------------------ diff --git a/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py index 507bec2bd42f..4b1596f0c499 100644 --- a/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py @@ -507,7 +507,6 @@ async def test_create_blob_with_question_mark(self, **kwargs): data = await stream.readall() assert data is not None assert data == blob_data - assert stream.properties['creation_time'] is not None @BlobPreparer() @recorded_by_proxy_async @@ -3183,4 +3182,30 @@ async def test_validate_empty_blob(self, **kwargs): assert await blob_client.exists() assert (await blob_client.get_blob_properties()).size == 0 + @BlobPreparer() + @recorded_by_proxy_async + async def test_download_properties(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + await self._setup(storage_account_name, storage_account_key) + + blob_name = self.get_resource_name("utcontainer") + blob_data = 'abc' + + # Act + blob = self.bsc.get_blob_client(self.container_name, blob_name) + await blob.upload_blob(blob_data) + + # Assert + stream = await blob.download_blob(encoding='utf-8') + props = stream.properties + data = await stream.readall() + + assert data is not None + assert data == blob_data + assert props['creation_time'] is not None + assert props['content_settings'] is not None + assert props['size'] == len(blob_data) + # ------------------------------------------------------------------------------