diff --git a/sdk/storage/azure-mgmt-storage/_meta.json b/sdk/storage/azure-mgmt-storage/_meta.json index f0e85fb8d046..ef9205268738 100644 --- a/sdk/storage/azure-mgmt-storage/_meta.json +++ b/sdk/storage/azure-mgmt-storage/_meta.json @@ -1,12 +1,12 @@ { - "commit": "43f10d3b8bacd5fc6b01254b5050c613f26c3573", + "commit": "c00fa600f516ecd4a35c7f7875ad67110778033b", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.13.19", + "@autorest/python@6.27.2", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/storage/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.13.19 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/storage/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.27.2 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/storage/resource-manager/readme.md", "package-2023-01": "2023-07-20 11:56:40 -0700 3e6b4ddca225530c27273d0f816466a905c0151b Microsoft.Storage/stable/2023-01-01/table.json", "package-2022-09": "2022-11-13 19:43:16 -0800 da0cfefaa0e6c237e1e3819f1cb2e11d7606878d Microsoft.Storage/stable/2022-09-01/table.json", diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_serialization.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_serialization.py index 8a43569e0754..a94487cbf17a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_serialization.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_serialization.py @@ -24,7 +24,6 @@ # # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -52,7 +51,6 @@ MutableMapping, Type, List, - Mapping, ) try: @@ -91,6 +89,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :param data: Input, could be bytes or stream (will be decoded with UTF8) or text :type data: str or bytes or IO :param str content_type: The content type. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +112,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -144,6 +144,8 @@ def _json_attemp(data): # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -153,6 +155,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -182,15 +189,30 @@ class UTC(datetime.tzinfo): """Time Zone info for handling UTC""" def utcoffset(self, dt): - """UTF offset for UTC is 0.""" + """UTF offset for UTC is 0. + + :param datetime.datetime dt: The datetime + :returns: The offset + :rtype: datetime.timedelta + """ return datetime.timedelta(0) def tzname(self, dt): - """Timestamp representation.""" + """Timestamp representation. + + :param datetime.datetime dt: The datetime + :returns: The timestamp representation + :rtype: str + """ return "Z" def dst(self, dt): - """No daylight saving for UTC.""" + """No daylight saving for UTC. + + :param datetime.datetime dt: The datetime + :returns: The daylight saving time + :rtype: datetime.timedelta + """ return datetime.timedelta(hours=1) @@ -204,7 +226,7 @@ class _FixedOffset(datetime.tzinfo): # type: ignore :param datetime.timedelta offset: offset in timedelta format """ - def __init__(self, offset): + def __init__(self, offset) -> None: self.__offset = offset def utcoffset(self, dt): @@ -233,24 +255,26 @@ def __getinitargs__(self): _FLATTEN = re.compile(r"(? None: self.additional_properties: Optional[Dict[str, Any]] = {} - for k in kwargs: + for k in kwargs: # pylint: disable=consider-using-dict-items 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__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -298,13 +329,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -324,7 +365,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -344,14 +389,14 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + 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, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, **kwargs: Any ) -> JSON: """Return a dict that can be serialized using json.dump. @@ -380,12 +425,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -395,7 +443,7 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @@ -408,6 +456,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @@ -426,9 +475,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -448,21 +499,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -501,11 +556,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -540,7 +597,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]]=None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -560,13 +617,16 @@ def __init__(self, classes: Optional[Mapping[str, type]]=None): self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict :raises: SerializationError if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -592,12 +652,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": @@ -633,7 +695,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): 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 the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") if len(splitted_tag) == 2: # Namespace @@ -664,17 +727,17 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise SerializationError(msg) from err - else: - return serialized + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict :raises: SerializationError if serialization fails. :raises: ValueError if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -703,7 +766,7 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: raise SerializationError("Unable to build a model: " + str(err)) from err @@ -712,9 +775,11 @@ def body(self, data, data_type, **kwargs): def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str + :returns: The serialized URL path :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -728,27 +793,26 @@ def url(self, name, data, data_type, **kwargs): output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output def query(self, name, data, data_type, **kwargs): """Serialize data intended for a URL query. - :param data: The data to be serialized. + :param str name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - do_quote = not kwargs.get('skip_quote', False) + do_quote = not kwargs.get("skip_quote", False) return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization @@ -759,19 +823,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def header(self, name, data, data_type, **kwargs): """Serialize data intended for a request header. - :param data: The data to be serialized. + :param str name: The name of the header. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -780,21 +845,20 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def serialize_data(self, data, data_type, **kwargs): """Serialize generic data according to supplied data type. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None :raises: AttributeError if required data is None. :raises: ValueError if data is None :raises: SerializationError if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") @@ -805,7 +869,7 @@ def serialize_data(self, data, data_type, **kwargs): if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -821,11 +885,10 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." raise SerializationError(msg.format(data, data_type)) from err - else: - return self._serialize(data, **kwargs) + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -841,23 +904,26 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec + return eval(data_type)(data) # nosec # pylint: disable=eval-used @classmethod def serialize_unicode(cls, data): """Special handling for serializing unicode strings in Py2. Encode to UTF-8 if unicode, otherwise handle as a str. - :param data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -871,8 +937,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -882,15 +947,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -907,12 +970,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): raise serialized.append(None) - if kwargs.get('do_quote', False): - serialized = [ - '' if s is None else quote(str(s), safe='') - for s - in serialized - ] + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] if div: serialized = ["" if s is None else str(s) for s in serialized] @@ -949,9 +1008,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -975,7 +1033,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Serialize a generic object. This will be handled as a dictionary. If object passed in is not a basic type (str, int, float, dict, list) it will simply be @@ -983,6 +1041,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -1007,7 +1066,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1038,56 +1097,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: 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}" - raise SerializationError(error.format(attr, enum_obj)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1095,11 +1159,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1109,30 +1174,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: TypeError if format invalid. + :return: serialized rfc """ try: if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1145,12 +1212,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: SerializationError if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1176,13 +1244,14 @@ def serialize_iso(attr, **kwargs): raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into IntTime format. This is represented as seconds. :param Datetime attr: Object to be serialized. :rtype: int :raises: SerializationError if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1190,11 +1259,11 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data @@ -1215,7 +1284,9 @@ def rest_key_extractor(attr, attr_desc, data): return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1236,17 +1307,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1283,7 +1366,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1335,22 +1418,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty if len(children) > 1: @@ -1358,7 +1440,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1367,9 +1449,9 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]]=None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1407,11 +1489,12 @@ def __call__(self, target_obj, response_data, content_type=None): :param str content_type: Swagger "produces" if available. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree @@ -1420,12 +1503,13 @@ def _deserialize(self, target_obj, data): :param object data: Object to deserialize. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: - for attr, mapconfig in data._attribute_map.items(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1444,13 +1528,13 @@ def _deserialize(self, target_obj, data): if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1480,9 +1564,8 @@ def _deserialize(self, target_obj, data): except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore raise DeserializationError(msg) from err - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: @@ -1509,6 +1592,8 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None @@ -1520,7 +1605,7 @@ def _classify_target(self, target, data): return target, target try: - target = target._classify(data, self.dependencies) # type: ignore + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1535,10 +1620,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1556,10 +1643,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. :raises JSONDecodeError: If JSON is requested and parsing is impossible. :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1583,24 +1672,35 @@ def _unpack_content(raw_data, content_type=None): def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ if callable(response): subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1609,15 +1709,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """Process data for deserialization according to data type. :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1631,7 +1732,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: return None data_val = self.deserialize_type[data_type](data) @@ -1651,14 +1756,14 @@ def deserialize_data(self, data, data_type): msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) raise DeserializationError(msg) from err - else: - return self._deserialize(obj_type, data) + return self._deserialize(obj_type, data) def deserialize_iter(self, attr, iter_type): """Deserialize an iterable. :param list attr: Iterable to be deserialized. :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1675,6 +1780,7 @@ def deserialize_dict(self, attr, dict_type): :param dict/list attr: Dictionary to be deserialized. Also accepts a list of key, value pairs. :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1685,11 +1791,12 @@ def deserialize_dict(self, attr, dict_type): attr = {el.tag: el.text for el in attr} return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - def deserialize_object(self, attr, **kwargs): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict :raises: TypeError if non-builtin datatype encountered. """ @@ -1724,11 +1831,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as @@ -1736,6 +1842,7 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool :raises: TypeError if string format is not valid. """ @@ -1747,24 +1854,23 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, str): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1772,6 +1878,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1785,8 +1892,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1798,6 +1904,7 @@ def deserialize_enum(data, enum_obj): :param str data: Response string to be deserialized. If this value is None or invalid it will be returned as-is. :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1808,9 +1915,9 @@ def deserialize_enum(data, enum_obj): # Workaround. We might consider remove it in the future. try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1826,6 +1933,7 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1838,6 +1946,7 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1853,8 +1962,9 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal + :return: Deserialized decimal :raises: DeserializationError if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text @@ -1869,6 +1979,7 @@ def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int :raises: ValueError if string format invalid. """ @@ -1881,6 +1992,7 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta :raises: DeserializationError if string format invalid. """ @@ -1891,14 +2003,14 @@ def deserialize_duration(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise DeserializationError(msg) from err - else: - return duration + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date :raises: DeserializationError if string format invalid. """ @@ -1914,6 +2026,7 @@ def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time :raises: DeserializationError if string format invalid. """ @@ -1928,6 +2041,7 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1943,14 +2057,14 @@ def deserialize_rfc(attr): except ValueError as err: msg = "Cannot deserialize to rfc datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1980,8 +2094,7 @@ def deserialize_iso(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_unix(attr): @@ -1989,6 +2102,7 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime :raises: DeserializationError if format invalid """ @@ -2000,5 +2114,4 @@ def deserialize_unix(attr): except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_storage_management_client.py index c886e7068b13..d067517610fa 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_storage_management_client.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from typing import Any, Optional, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.mgmt.core import ARMPipelineClient diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/aio/_storage_management_client.py index 7b8be2ef1c9d..3050e862e4af 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/aio/_storage_management_client.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from typing import Any, Optional, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.mgmt.core import AsyncARMPipelineClient diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/__init__.py index ebdc1d61615b..17522f0d6d17 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management import StorageManagement +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management import StorageManagement # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagement", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_configuration.py index 09db0170b783..452938977130 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagement. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_metadata.json index ba16009ace9d..a32a513f4641 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_storage_management.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_storage_management.py index 777c2cd0a24f..98a4bc985533 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_storage_management.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_storage_management.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -20,11 +21,10 @@ from .operations import StorageAccountsOperations, UsageOperations if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagement: # pylint: disable=client-accepts-api-version-keyword +class StorageManagement: """The Azure Storage Management API. :ivar storage_accounts: StorageAccountsOperations operations @@ -107,7 +107,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagement": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_version.py index 83bf7bbed684..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/__init__.py index 2ef22c4bc437..dcbae2659e8b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management import StorageManagement +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management import StorageManagement # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagement", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/_configuration.py index 1b6493b10e64..a80ce99fbe18 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagement. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/_storage_management.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/_storage_management.py index 826154c6ccd4..9cbcfa0a3ec6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/_storage_management.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/_storage_management.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -20,11 +21,10 @@ from .operations import StorageAccountsOperations, UsageOperations if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagement: # pylint: disable=client-accepts-api-version-keyword +class StorageManagement: """The Azure Storage Management API. :ivar storage_accounts: StorageAccountsOperations operations @@ -110,7 +110,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagement": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/operations/__init__.py index 6f4f0606778e..442238573341 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/operations/__init__.py @@ -5,17 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_accounts_operations import StorageAccountsOperations -from ._usage_operations import UsageOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usage_operations import UsageOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "StorageAccountsOperations", "UsageOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/operations/_storage_accounts_operations.py index ba7e3fe72204..dfbdec337e21 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_check_name_availability_request, build_create_request, @@ -47,7 +47,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -130,7 +130,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2015_06_15.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -162,7 +162,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -176,7 +175,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -189,8 +188,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -203,7 +202,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-06-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -224,10 +223,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -235,12 +234,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -366,10 +367,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -392,9 +394,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -408,7 +408,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -430,7 +430,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -466,7 +465,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2015_06_15.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -488,7 +487,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -502,7 +500,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -613,7 +611,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2015_06_15.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -647,7 +645,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -661,7 +658,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -684,7 +681,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-06-15")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -701,7 +698,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -717,7 +713,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -767,7 +762,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-06-15")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -785,7 +780,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -801,7 +795,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -845,7 +838,7 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: :rtype: ~azure.mgmt.storage.v2015_06_15.models.StorageAccountKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -867,7 +860,6 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -881,7 +873,7 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountKeys", pipeline_response) + deserialized = self._deserialize("StorageAccountKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -974,7 +966,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2015_06_15.models.StorageAccountKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1008,7 +1000,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1022,7 +1013,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountKeys", pipeline_response) + deserialized = self._deserialize("StorageAccountKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/operations/_usage_operations.py index 832adc843ace..679e435ffbff 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/aio/operations/_usage_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usage_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Usage"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-06-15")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/__init__.py index 159ef4af78dd..bc252b8e2d01 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/__init__.py @@ -5,29 +5,40 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CustomDomain -from ._models_py3 import Endpoints -from ._models_py3 import Resource -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountKeys -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName +from typing import TYPE_CHECKING -from ._storage_management_enums import AccountStatus -from ._storage_management_enums import AccountType -from ._storage_management_enums import ProvisioningState -from ._storage_management_enums import Reason -from ._storage_management_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + CheckNameAvailabilityResult, + CustomDomain, + Endpoints, + Resource, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountKeys, + StorageAccountListResult, + StorageAccountRegenerateKeyParameters, + StorageAccountUpdateParameters, + Usage, + UsageListResult, + UsageName, +) + +from ._storage_management_enums import ( # type: ignore + AccountStatus, + AccountType, + ProvisioningState, + Reason, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -51,5 +62,5 @@ "Reason", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/_models_py3.py index c7c3218ea125..fd4652e5e97e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/_models_py3.py @@ -1,5 +1,4 @@ # coding=utf-8 -# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,7 +12,6 @@ from ... import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -190,7 +188,7 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s self.tags = tags -class StorageAccount(Resource): # pylint: disable=too-many-instance-attributes +class StorageAccount(Resource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/operations/__init__.py index 6f4f0606778e..442238573341 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/operations/__init__.py @@ -5,17 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_accounts_operations import StorageAccountsOperations -from ._usage_operations import UsageOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usage_operations import UsageOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "StorageAccountsOperations", "UsageOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/operations/_storage_accounts_operations.py index ed828ac2a2f9..5838fc807bdb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -406,7 +406,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2015_06_15.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -438,7 +438,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -452,7 +451,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -465,8 +464,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -479,7 +478,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-06-15")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -500,10 +499,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -511,12 +510,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -639,10 +640,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -681,7 +683,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -703,7 +705,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -737,7 +738,7 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: :rtype: ~azure.mgmt.storage.v2015_06_15.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -759,7 +760,6 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -773,7 +773,7 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -884,7 +884,7 @@ def update( :rtype: ~azure.mgmt.storage.v2015_06_15.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -918,7 +918,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -932,7 +931,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -954,7 +953,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-06-15")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -971,7 +970,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -987,7 +985,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1034,7 +1031,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-06-15")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1052,7 +1049,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1068,7 +1064,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1112,7 +1107,7 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2015_06_15.models.StorageAccountKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1134,7 +1129,6 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1148,7 +1142,7 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountKeys", pipeline_response) + deserialized = self._deserialize("StorageAccountKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1241,7 +1235,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2015_06_15.models.StorageAccountKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1275,7 +1269,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1289,7 +1282,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountKeys", pipeline_response) + deserialized = self._deserialize("StorageAccountKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/operations/_usage_operations.py index 6dd8e11adf0a..1526f6da3314 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/operations/_usage_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Usage"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-06-15")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/__init__.py index a860a5c185c9..60980065e1ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_configuration.py index 0311eb048776..50329ece5044 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_metadata.json index b49e8562233a..27251b7fd70f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_storage_management_client.py index 57ba78f99452..6f761c96da98 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -20,11 +21,10 @@ from .operations import StorageAccountsOperations, UsageOperations if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword +class StorageManagementClient: """The Storage Management Client. :ivar storage_accounts: StorageAccountsOperations operations @@ -109,7 +109,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_version.py index 83bf7bbed684..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/__init__.py index a5c3d2414cfd..ee2b940bd4fc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/_configuration.py index c855fa5f21b5..909aa6433e78 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/_storage_management_client.py index e01f6ceeb104..d5839e7a1215 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -20,11 +21,10 @@ from .operations import StorageAccountsOperations, UsageOperations if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword +class StorageManagementClient: """The Storage Management Client. :ivar storage_accounts: StorageAccountsOperations operations @@ -112,7 +112,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/operations/__init__.py index 6f4f0606778e..442238573341 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/operations/__init__.py @@ -5,17 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_accounts_operations import StorageAccountsOperations -from ._usage_operations import UsageOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usage_operations import UsageOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "StorageAccountsOperations", "UsageOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/operations/_storage_accounts_operations.py index d48b50887736..d418aca7287c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_check_name_availability_request, build_create_request, @@ -47,7 +47,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -130,7 +130,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2016_01_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -162,7 +162,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -176,7 +175,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -189,8 +188,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -203,7 +202,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -224,10 +223,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -235,12 +234,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -366,10 +367,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -392,9 +394,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. @@ -408,7 +408,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -430,7 +430,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -466,7 +465,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2016_01_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -488,7 +487,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -502,7 +500,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -613,7 +611,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2016_01_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -647,7 +645,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -661,7 +658,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -684,7 +681,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-01-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -701,7 +698,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -717,7 +713,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -767,7 +762,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-01-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -785,7 +780,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -801,7 +795,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -847,7 +840,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2016_01_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -869,7 +862,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -883,7 +875,7 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -976,7 +968,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2016_01_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1010,7 +1002,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1024,7 +1015,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/operations/_usage_operations.py index 9c5b1fd952bb..5b50a0730980 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/aio/operations/_usage_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usage_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Usage"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-01-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/__init__.py index c653cb309885..932acd6335bb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/__init__.py @@ -5,40 +5,51 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CustomDomain -from ._models_py3 import Encryption -from ._models_py3 import EncryptionService -from ._models_py3 import EncryptionServices -from ._models_py3 import Endpoints -from ._models_py3 import Resource -from ._models_py3 import Sku -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountKey -from ._models_py3 import StorageAccountListKeysResult -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName +from typing import TYPE_CHECKING -from ._storage_management_client_enums import AccessTier -from ._storage_management_client_enums import AccountStatus -from ._storage_management_client_enums import EncryptionKeySource -from ._storage_management_client_enums import KeyPermission -from ._storage_management_client_enums import Kind -from ._storage_management_client_enums import ProvisioningState -from ._storage_management_client_enums import Reason -from ._storage_management_client_enums import SkuName -from ._storage_management_client_enums import SkuTier -from ._storage_management_client_enums import StorageAccountCheckNameAvailabilityParametersType -from ._storage_management_client_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + CheckNameAvailabilityResult, + CustomDomain, + Encryption, + EncryptionService, + EncryptionServices, + Endpoints, + Resource, + Sku, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountKey, + StorageAccountListKeysResult, + StorageAccountListResult, + StorageAccountRegenerateKeyParameters, + StorageAccountUpdateParameters, + Usage, + UsageListResult, + UsageName, +) + +from ._storage_management_client_enums import ( # type: ignore + AccessTier, + AccountStatus, + EncryptionKeySource, + KeyPermission, + Kind, + ProvisioningState, + Reason, + SkuName, + SkuTier, + StorageAccountCheckNameAvailabilityParametersType, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -73,5 +84,5 @@ "StorageAccountCheckNameAvailabilityParametersType", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/_models_py3.py index 3267ab956a8c..9fdf73c6989c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/_models_py3.py @@ -1,5 +1,4 @@ # coding=utf-8 -# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -12,7 +11,6 @@ from ... import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -307,7 +305,7 @@ def __init__(self, *, name: Union[str, "_models.SkuName"], **kwargs: Any) -> Non self.tier = None -class StorageAccount(Resource): # pylint: disable=too-many-instance-attributes +class StorageAccount(Resource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/operations/__init__.py index 6f4f0606778e..442238573341 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/operations/__init__.py @@ -5,17 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_accounts_operations import StorageAccountsOperations -from ._usage_operations import UsageOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usage_operations import UsageOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "StorageAccountsOperations", "UsageOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/operations/_storage_accounts_operations.py index fff2005955c9..3b5dad644276 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -392,7 +392,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2016_01_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -424,7 +424,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -438,7 +437,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -451,8 +450,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -465,7 +464,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -486,10 +485,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -497,12 +496,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -625,10 +626,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -667,7 +669,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -689,7 +691,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -723,7 +724,7 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: :rtype: ~azure.mgmt.storage.v2016_01_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -745,7 +746,6 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -759,7 +759,7 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -870,7 +870,7 @@ def update( :rtype: ~azure.mgmt.storage.v2016_01_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -904,7 +904,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -918,7 +917,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -940,7 +939,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-01-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -957,7 +956,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -973,7 +971,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1020,7 +1017,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-01-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1038,7 +1035,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1054,7 +1050,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1100,7 +1095,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2016_01_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1122,7 +1117,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1136,7 +1130,7 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1229,7 +1223,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2016_01_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1263,7 +1257,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1277,7 +1270,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/operations/_usage_operations.py index 54c5a4026a5e..b1e72929ef93 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/operations/_usage_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Usage"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-01-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/__init__.py index ebdc1d61615b..17522f0d6d17 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management import StorageManagement +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management import StorageManagement # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagement", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_configuration.py index 3039798df557..7dbcae8cdece 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagement. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_metadata.json index 8f1101556fc6..7b311c5dcf6a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_storage_management.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_storage_management.py index 769d635425fc..1b1448b80f02 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_storage_management.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_storage_management.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -20,11 +21,10 @@ from .operations import StorageAccountsOperations, UsageOperations if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagement: # pylint: disable=client-accepts-api-version-keyword +class StorageManagement: """The Azure Storage Management API. :ivar storage_accounts: StorageAccountsOperations operations @@ -107,7 +107,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagement": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_version.py index 5a163c0afedc..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" \ No newline at end of file +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/__init__.py index 2ef22c4bc437..dcbae2659e8b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management import StorageManagement +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management import StorageManagement # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagement", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/_configuration.py index 2aca0751aec4..f85b203a4f28 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagement. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/_storage_management.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/_storage_management.py index 644c89ba9a94..c82fb493de65 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/_storage_management.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/_storage_management.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -20,11 +21,10 @@ from .operations import StorageAccountsOperations, UsageOperations if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagement: # pylint: disable=client-accepts-api-version-keyword +class StorageManagement: """The Azure Storage Management API. :ivar storage_accounts: StorageAccountsOperations operations @@ -110,7 +110,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagement": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/operations/__init__.py index 6f4f0606778e..442238573341 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/operations/__init__.py @@ -5,17 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_accounts_operations import StorageAccountsOperations -from ._usage_operations import UsageOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usage_operations import UsageOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "StorageAccountsOperations", "UsageOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/operations/_storage_accounts_operations.py index 18293a865192..b978dfc406b1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_check_name_availability_request, build_create_request, @@ -49,7 +49,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -132,7 +132,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2016_12_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +164,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -178,7 +177,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -191,8 +190,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -205,7 +204,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -226,10 +225,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -237,12 +236,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -368,10 +369,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -394,9 +396,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -410,7 +410,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -432,7 +432,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -468,7 +467,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2016_12_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -490,7 +489,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -504,7 +502,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -615,7 +613,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2016_12_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -649,7 +647,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -663,7 +660,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -686,7 +683,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-12-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -703,7 +700,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -719,7 +715,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -769,7 +764,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-12-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -787,7 +782,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -803,7 +797,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -849,7 +842,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2016_12_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -871,7 +864,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -885,7 +877,7 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -978,7 +970,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2016_12_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1012,7 +1004,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1026,7 +1017,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1117,7 +1108,7 @@ async def list_account_sas( :rtype: ~azure.mgmt.storage.v2016_12_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1151,7 +1142,6 @@ async def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1165,7 +1155,7 @@ async def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1254,7 +1244,7 @@ async def list_service_sas( :rtype: ~azure.mgmt.storage.v2016_12_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1288,7 +1278,6 @@ async def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1302,7 +1291,7 @@ async def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/operations/_usage_operations.py index c8829cd2187a..549ac245fa26 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/aio/operations/_usage_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usage_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Usage"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-12-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/__init__.py index 6ec79aa2654b..42ca12ca76b3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/__init__.py @@ -5,50 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccountSasParameters -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CustomDomain -from ._models_py3 import Encryption -from ._models_py3 import EncryptionService -from ._models_py3 import EncryptionServices -from ._models_py3 import Endpoints -from ._models_py3 import ListAccountSasResponse -from ._models_py3 import ListServiceSasResponse -from ._models_py3 import Resource -from ._models_py3 import ServiceSasParameters -from ._models_py3 import Sku -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountKey -from ._models_py3 import StorageAccountListKeysResult -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName +from typing import TYPE_CHECKING -from ._storage_management_enums import AccessTier -from ._storage_management_enums import AccountSasParametersSignedPermission -from ._storage_management_enums import AccountSasParametersSignedResourceTypes -from ._storage_management_enums import AccountSasParametersSignedServices -from ._storage_management_enums import AccountStatus -from ._storage_management_enums import EncryptionKeySource -from ._storage_management_enums import HttpProtocol -from ._storage_management_enums import KeyPermission -from ._storage_management_enums import Kind -from ._storage_management_enums import Permissions -from ._storage_management_enums import ProvisioningState -from ._storage_management_enums import Reason -from ._storage_management_enums import SignedResource -from ._storage_management_enums import SkuName -from ._storage_management_enums import SkuTier -from ._storage_management_enums import StorageAccountCheckNameAvailabilityParametersType -from ._storage_management_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccountSasParameters, + CheckNameAvailabilityResult, + CustomDomain, + Encryption, + EncryptionService, + EncryptionServices, + Endpoints, + ListAccountSasResponse, + ListServiceSasResponse, + Resource, + ServiceSasParameters, + Sku, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountKey, + StorageAccountListKeysResult, + StorageAccountListResult, + StorageAccountRegenerateKeyParameters, + StorageAccountUpdateParameters, + Usage, + UsageListResult, + UsageName, +) + +from ._storage_management_enums import ( # type: ignore + AccessTier, + AccountSasParametersSignedPermission, + AccountSasParametersSignedResourceTypes, + AccountSasParametersSignedServices, + AccountStatus, + EncryptionKeySource, + HttpProtocol, + KeyPermission, + Kind, + Permissions, + ProvisioningState, + Reason, + SignedResource, + SkuName, + SkuTier, + StorageAccountCheckNameAvailabilityParametersType, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -93,5 +104,5 @@ "StorageAccountCheckNameAvailabilityParametersType", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/_models_py3.py index 1439256ff1e5..dba5e428457e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,7 +13,6 @@ from ... import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -451,7 +450,7 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s self.tags = tags -class ServiceSasParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ServiceSasParameters(_serialization.Model): """The parameters to list service SAS credentials of a specific resource. All required parameters must be populated in order to send to server. @@ -656,7 +655,7 @@ def __init__(self, *, name: Union[str, "_models.SkuName"], **kwargs: Any) -> Non self.tier = None -class StorageAccount(Resource): # pylint: disable=too-many-instance-attributes +class StorageAccount(Resource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/operations/__init__.py index 6f4f0606778e..442238573341 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/operations/__init__.py @@ -5,17 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_accounts_operations import StorageAccountsOperations -from ._usage_operations import UsageOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usage_operations import UsageOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "StorageAccountsOperations", "UsageOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/operations/_storage_accounts_operations.py index 981fccbf45ca..5518d84f94ca 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -478,7 +478,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2016_12_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -510,7 +510,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -524,7 +523,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -537,8 +536,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -551,7 +550,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-12-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -572,10 +571,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -583,12 +582,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -711,10 +712,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -753,7 +755,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -775,7 +777,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -809,7 +810,7 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: :rtype: ~azure.mgmt.storage.v2016_12_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -831,7 +832,6 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -845,7 +845,7 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -956,7 +956,7 @@ def update( :rtype: ~azure.mgmt.storage.v2016_12_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -990,7 +990,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1004,7 +1003,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1026,7 +1025,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-12-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1043,7 +1042,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1059,7 +1057,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1106,7 +1103,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-12-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1124,7 +1121,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1140,7 +1136,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1186,7 +1181,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2016_12_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1208,7 +1203,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1222,7 +1216,7 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1315,7 +1309,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2016_12_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1349,7 +1343,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1363,7 +1356,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1454,7 +1447,7 @@ def list_account_sas( :rtype: ~azure.mgmt.storage.v2016_12_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1488,7 +1481,6 @@ def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1502,7 +1494,7 @@ def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1591,7 +1583,7 @@ def list_service_sas( :rtype: ~azure.mgmt.storage.v2016_12_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1625,7 +1617,6 @@ def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1639,7 +1630,7 @@ def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/operations/_usage_operations.py index 1763e0c4bb26..f8944d050cc9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/operations/_usage_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Usage"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-12-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/__init__.py index ebdc1d61615b..17522f0d6d17 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management import StorageManagement +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management import StorageManagement # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagement", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_configuration.py index e27394844bfd..7557dc4809fd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagement. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_metadata.json index b4b43b89dad4..e843922043be 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_storage_management.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_storage_management.py index 8e0af196437c..3b512565be5d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_storage_management.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_storage_management.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -20,11 +21,10 @@ from .operations import Operations, SkusOperations, StorageAccountsOperations, UsageOperations if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagement: # pylint: disable=client-accepts-api-version-keyword +class StorageManagement: """The Azure Storage Management API. :ivar operations: Operations operations @@ -113,7 +113,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagement": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_version.py index 83bf7bbed684..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/__init__.py index 2ef22c4bc437..dcbae2659e8b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management import StorageManagement +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management import StorageManagement # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagement", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/_configuration.py index fa18f5c958e5..6e16daa81de8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagement. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/_storage_management.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/_storage_management.py index 1b663a575503..0bf5288b2c6b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/_storage_management.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/_storage_management.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -20,11 +21,10 @@ from .operations import Operations, SkusOperations, StorageAccountsOperations, UsageOperations if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagement: # pylint: disable=client-accepts-api-version-keyword +class StorageManagement: """The Azure Storage Management API. :ivar operations: Operations operations @@ -116,7 +116,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagement": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/__init__.py index 31ab94a0a14c..82f79dffd3fb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/__init__.py @@ -5,14 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._usage_operations import UsageOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usage_operations import UsageOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -21,5 +27,5 @@ "StorageAccountsOperations", "UsageOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_operations.py index 55a8c1dc6300..ec54a90bc353 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-06-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_skus_operations.py index e54fbd1ab774..85bdd533f836 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Sku"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-06-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_storage_accounts_operations.py index 8b2603496358..73888be441d2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_check_name_availability_request, build_create_request, @@ -49,7 +49,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -132,7 +132,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2017_06_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +164,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -178,7 +177,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -191,8 +190,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -205,7 +204,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -226,10 +225,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -237,12 +236,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -368,10 +369,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -394,9 +396,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -410,7 +410,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -432,7 +432,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -468,7 +467,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2017_06_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -490,7 +489,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -504,7 +502,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -615,7 +613,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2017_06_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -649,7 +647,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -663,7 +660,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -686,7 +683,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-06-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -703,7 +700,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -719,7 +715,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -769,7 +764,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-06-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -787,7 +782,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -803,7 +797,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -849,7 +842,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2017_06_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -871,7 +864,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -885,7 +877,7 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -978,7 +970,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2017_06_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1012,7 +1004,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1026,7 +1017,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1117,7 +1108,7 @@ async def list_account_sas( :rtype: ~azure.mgmt.storage.v2017_06_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1151,7 +1142,6 @@ async def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1165,7 +1155,7 @@ async def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1254,7 +1244,7 @@ async def list_service_sas( :rtype: ~azure.mgmt.storage.v2017_06_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1288,7 +1278,6 @@ async def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1302,7 +1291,7 @@ async def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_usage_operations.py index ee0c5ccba978..484bce0afa39 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/aio/operations/_usage_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usage_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Usage"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-06-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/__init__.py index facc79b3796a..f56c2d598d3f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/__init__.py @@ -5,66 +5,77 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccountSasParameters -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CustomDomain -from ._models_py3 import Dimension -from ._models_py3 import Encryption -from ._models_py3 import EncryptionService -from ._models_py3 import EncryptionServices -from ._models_py3 import Endpoints -from ._models_py3 import IPRule -from ._models_py3 import Identity -from ._models_py3 import KeyVaultProperties -from ._models_py3 import ListAccountSasResponse -from ._models_py3 import ListServiceSasResponse -from ._models_py3 import MetricSpecification -from ._models_py3 import NetworkRuleSet -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import Resource -from ._models_py3 import Restriction -from ._models_py3 import SKUCapability -from ._models_py3 import ServiceSasParameters -from ._models_py3 import ServiceSpecification -from ._models_py3 import Sku -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountKey -from ._models_py3 import StorageAccountListKeysResult -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import StorageSkuListResult -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._storage_management_enums import AccessTier -from ._storage_management_enums import AccountStatus -from ._storage_management_enums import Bypass -from ._storage_management_enums import DefaultAction -from ._storage_management_enums import HttpProtocol -from ._storage_management_enums import KeyPermission -from ._storage_management_enums import KeySource -from ._storage_management_enums import Kind -from ._storage_management_enums import Permissions -from ._storage_management_enums import ProvisioningState -from ._storage_management_enums import Reason -from ._storage_management_enums import ReasonCode -from ._storage_management_enums import Services -from ._storage_management_enums import SignedResource -from ._storage_management_enums import SignedResourceTypes -from ._storage_management_enums import SkuName -from ._storage_management_enums import SkuTier -from ._storage_management_enums import State -from ._storage_management_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccountSasParameters, + CheckNameAvailabilityResult, + CustomDomain, + Dimension, + Encryption, + EncryptionService, + EncryptionServices, + Endpoints, + IPRule, + Identity, + KeyVaultProperties, + ListAccountSasResponse, + ListServiceSasResponse, + MetricSpecification, + NetworkRuleSet, + Operation, + OperationDisplay, + OperationListResult, + Resource, + Restriction, + SKUCapability, + ServiceSasParameters, + ServiceSpecification, + Sku, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountKey, + StorageAccountListKeysResult, + StorageAccountListResult, + StorageAccountRegenerateKeyParameters, + StorageAccountUpdateParameters, + StorageSkuListResult, + Usage, + UsageListResult, + UsageName, + VirtualNetworkRule, +) + +from ._storage_management_enums import ( # type: ignore + AccessTier, + AccountStatus, + Bypass, + DefaultAction, + HttpProtocol, + KeyPermission, + KeySource, + Kind, + Permissions, + ProvisioningState, + Reason, + ReasonCode, + Services, + SignedResource, + SignedResourceTypes, + SkuName, + SkuTier, + State, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -125,5 +136,5 @@ "State", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/_models_py3.py index e012bfb9bd9b..adb8e2a6515d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,7 +13,6 @@ from ... import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -879,7 +878,7 @@ def __init__(self, *, reason_code: Optional[Union[str, "_models.ReasonCode"]] = self.reason_code = reason_code -class ServiceSasParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ServiceSasParameters(_serialization.Model): """The parameters to list service SAS credentials of a specific resource. All required parameters must be populated in order to send to server. @@ -1175,7 +1174,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class StorageAccount(Resource): # pylint: disable=too-many-instance-attributes +class StorageAccount(Resource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/__init__.py index 31ab94a0a14c..82f79dffd3fb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/__init__.py @@ -5,14 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._usage_operations import UsageOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usage_operations import UsageOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -21,5 +27,5 @@ "StorageAccountsOperations", "UsageOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_operations.py index bcb68adbb087..17612887387b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-06-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -126,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_skus_operations.py index b1ded8632765..892b8efa6c99 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Sku"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-06-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_storage_accounts_operations.py index e7abb7a05e80..5def5533c0ea 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -478,7 +478,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2017_06_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -510,7 +510,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -524,7 +523,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -537,8 +536,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -551,7 +550,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -572,10 +571,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -583,12 +582,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -711,10 +712,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -753,7 +755,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -775,7 +777,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -809,7 +810,7 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: :rtype: ~azure.mgmt.storage.v2017_06_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -831,7 +832,6 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -845,7 +845,7 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -956,7 +956,7 @@ def update( :rtype: ~azure.mgmt.storage.v2017_06_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -990,7 +990,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1004,7 +1003,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1026,7 +1025,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-06-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1043,7 +1042,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1059,7 +1057,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1106,7 +1103,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-06-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1124,7 +1121,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1140,7 +1136,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1186,7 +1181,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2017_06_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1208,7 +1203,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1222,7 +1216,7 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1315,7 +1309,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2017_06_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1349,7 +1343,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1363,7 +1356,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1454,7 +1447,7 @@ def list_account_sas( :rtype: ~azure.mgmt.storage.v2017_06_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1488,7 +1481,6 @@ def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1502,7 +1494,7 @@ def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1591,7 +1583,7 @@ def list_service_sas( :rtype: ~azure.mgmt.storage.v2017_06_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1625,7 +1617,6 @@ def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1639,7 +1630,7 @@ def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_usage_operations.py index 0a42f4cc9a4c..182be5629515 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/operations/_usage_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Usage"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-06-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/__init__.py index ebdc1d61615b..17522f0d6d17 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management import StorageManagement +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management import StorageManagement # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagement", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_configuration.py index e9160a98d485..165810133ed9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagement. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_metadata.json index 3483d607603e..4925a26ad8dd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_storage_management.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_storage_management.py index e70c762bb6b8..8e7f69c38871 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_storage_management.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_storage_management.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -20,11 +21,10 @@ from .operations import Operations, SkusOperations, StorageAccountsOperations, UsageOperations if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagement: # pylint: disable=client-accepts-api-version-keyword +class StorageManagement: """The Azure Storage Management API. :ivar operations: Operations operations @@ -113,7 +113,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagement": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_version.py index 83bf7bbed684..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/__init__.py index 2ef22c4bc437..dcbae2659e8b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management import StorageManagement +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management import StorageManagement # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagement", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/_configuration.py index 78a95de1e473..b2fba38435a2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagement. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/_storage_management.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/_storage_management.py index 726cc155f1c9..b1d55079ba73 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/_storage_management.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/_storage_management.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -20,11 +21,10 @@ from .operations import Operations, SkusOperations, StorageAccountsOperations, UsageOperations if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagement: # pylint: disable=client-accepts-api-version-keyword +class StorageManagement: """The Azure Storage Management API. :ivar operations: Operations operations @@ -116,7 +116,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagement": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/__init__.py index 31ab94a0a14c..82f79dffd3fb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/__init__.py @@ -5,14 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._usage_operations import UsageOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usage_operations import UsageOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -21,5 +27,5 @@ "StorageAccountsOperations", "UsageOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_operations.py index a5aaccc7964c..bcbd3156318b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_skus_operations.py index 25f1d84fc141..aabda291af58 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Sku"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_storage_accounts_operations.py index 4a6de0c283b6..5f207b31e949 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_check_name_availability_request, build_create_request, @@ -49,7 +49,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -132,7 +132,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2017_10_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +164,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -178,7 +177,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -191,8 +190,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -205,7 +204,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -226,10 +225,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -237,12 +236,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -368,10 +369,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -394,9 +396,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -410,7 +410,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -432,7 +432,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -468,7 +467,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2017_10_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -490,7 +489,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -504,7 +502,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -615,7 +613,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2017_10_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -649,7 +647,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -663,7 +660,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -686,7 +683,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -703,7 +700,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -719,7 +715,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -769,7 +764,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -787,7 +782,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -803,7 +797,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -849,7 +842,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2017_10_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -871,7 +864,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -885,7 +877,7 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -978,7 +970,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2017_10_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1012,7 +1004,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1026,7 +1017,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1117,7 +1108,7 @@ async def list_account_sas( :rtype: ~azure.mgmt.storage.v2017_10_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1151,7 +1142,6 @@ async def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1165,7 +1155,7 @@ async def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1254,7 +1244,7 @@ async def list_service_sas( :rtype: ~azure.mgmt.storage.v2017_10_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1288,7 +1278,6 @@ async def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1302,7 +1291,7 @@ async def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_usage_operations.py index 82f0b03597f3..41357330f1e4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/aio/operations/_usage_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usage_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Usage"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/__init__.py index facc79b3796a..f56c2d598d3f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/__init__.py @@ -5,66 +5,77 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccountSasParameters -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CustomDomain -from ._models_py3 import Dimension -from ._models_py3 import Encryption -from ._models_py3 import EncryptionService -from ._models_py3 import EncryptionServices -from ._models_py3 import Endpoints -from ._models_py3 import IPRule -from ._models_py3 import Identity -from ._models_py3 import KeyVaultProperties -from ._models_py3 import ListAccountSasResponse -from ._models_py3 import ListServiceSasResponse -from ._models_py3 import MetricSpecification -from ._models_py3 import NetworkRuleSet -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import Resource -from ._models_py3 import Restriction -from ._models_py3 import SKUCapability -from ._models_py3 import ServiceSasParameters -from ._models_py3 import ServiceSpecification -from ._models_py3 import Sku -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountKey -from ._models_py3 import StorageAccountListKeysResult -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import StorageSkuListResult -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._storage_management_enums import AccessTier -from ._storage_management_enums import AccountStatus -from ._storage_management_enums import Bypass -from ._storage_management_enums import DefaultAction -from ._storage_management_enums import HttpProtocol -from ._storage_management_enums import KeyPermission -from ._storage_management_enums import KeySource -from ._storage_management_enums import Kind -from ._storage_management_enums import Permissions -from ._storage_management_enums import ProvisioningState -from ._storage_management_enums import Reason -from ._storage_management_enums import ReasonCode -from ._storage_management_enums import Services -from ._storage_management_enums import SignedResource -from ._storage_management_enums import SignedResourceTypes -from ._storage_management_enums import SkuName -from ._storage_management_enums import SkuTier -from ._storage_management_enums import State -from ._storage_management_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccountSasParameters, + CheckNameAvailabilityResult, + CustomDomain, + Dimension, + Encryption, + EncryptionService, + EncryptionServices, + Endpoints, + IPRule, + Identity, + KeyVaultProperties, + ListAccountSasResponse, + ListServiceSasResponse, + MetricSpecification, + NetworkRuleSet, + Operation, + OperationDisplay, + OperationListResult, + Resource, + Restriction, + SKUCapability, + ServiceSasParameters, + ServiceSpecification, + Sku, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountKey, + StorageAccountListKeysResult, + StorageAccountListResult, + StorageAccountRegenerateKeyParameters, + StorageAccountUpdateParameters, + StorageSkuListResult, + Usage, + UsageListResult, + UsageName, + VirtualNetworkRule, +) + +from ._storage_management_enums import ( # type: ignore + AccessTier, + AccountStatus, + Bypass, + DefaultAction, + HttpProtocol, + KeyPermission, + KeySource, + Kind, + Permissions, + ProvisioningState, + Reason, + ReasonCode, + Services, + SignedResource, + SignedResourceTypes, + SkuName, + SkuTier, + State, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -125,5 +136,5 @@ "State", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/_models_py3.py index d4f6532dd4e7..a9c3038971ec 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,7 +13,6 @@ from ... import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -879,7 +878,7 @@ def __init__(self, *, reason_code: Optional[Union[str, "_models.ReasonCode"]] = self.reason_code = reason_code -class ServiceSasParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ServiceSasParameters(_serialization.Model): """The parameters to list service SAS credentials of a specific resource. All required parameters must be populated in order to send to server. @@ -1175,7 +1174,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class StorageAccount(Resource): # pylint: disable=too-many-instance-attributes +class StorageAccount(Resource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/__init__.py index 31ab94a0a14c..82f79dffd3fb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/__init__.py @@ -5,14 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._usage_operations import UsageOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usage_operations import UsageOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -21,5 +27,5 @@ "StorageAccountsOperations", "UsageOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_operations.py index f083729b23e6..aa6c8d22805d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -126,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_skus_operations.py index 230c0823c1af..5d71b62cf25a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Sku"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_storage_accounts_operations.py index d6d0140c364c..98f58ee8403d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -478,7 +478,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2017_10_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -510,7 +510,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -524,7 +523,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -537,8 +536,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -551,7 +550,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -572,10 +571,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -583,12 +582,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -711,10 +712,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -753,7 +755,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -775,7 +777,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -809,7 +810,7 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: :rtype: ~azure.mgmt.storage.v2017_10_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -831,7 +832,6 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -845,7 +845,7 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -956,7 +956,7 @@ def update( :rtype: ~azure.mgmt.storage.v2017_10_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -990,7 +990,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1004,7 +1003,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1026,7 +1025,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1043,7 +1042,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1059,7 +1057,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1106,7 +1103,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1124,7 +1121,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1140,7 +1136,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1186,7 +1181,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2017_10_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1208,7 +1203,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1222,7 +1216,7 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1315,7 +1309,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2017_10_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1349,7 +1343,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1363,7 +1356,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1454,7 +1447,7 @@ def list_account_sas( :rtype: ~azure.mgmt.storage.v2017_10_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1488,7 +1481,6 @@ def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1502,7 +1494,7 @@ def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1591,7 +1583,7 @@ def list_service_sas( :rtype: ~azure.mgmt.storage.v2017_10_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1625,7 +1617,6 @@ def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1639,7 +1630,7 @@ def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_usage_operations.py index f2445500601c..cad037dfb31a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/operations/_usage_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Usage"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-10-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/__init__.py index a860a5c185c9..60980065e1ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_configuration.py index a32884e28a53..805962ffc8d5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_metadata.json index 0b1ed2583e14..845669689c06 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_storage_management_client.py index 012416d187fa..9a2c92531662 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -20,11 +21,10 @@ from .operations import BlobContainersOperations, Operations, SkusOperations, StorageAccountsOperations, UsageOperations if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -119,7 +119,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_version.py index 83bf7bbed684..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/__init__.py index a5c3d2414cfd..ee2b940bd4fc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/_configuration.py index ca6b0160974a..476e8ae26aef 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/_storage_management_client.py index e68f0596f59f..d93adf8b0c2f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -20,11 +21,10 @@ from .operations import BlobContainersOperations, Operations, SkusOperations, StorageAccountsOperations, UsageOperations if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -123,7 +123,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/__init__.py index abe747aa8c96..75b3760133ed 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._usage_operations import UsageOperations -from ._blob_containers_operations import BlobContainersOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usage_operations import UsageOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -23,5 +29,5 @@ "UsageOperations", "BlobContainersOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_blob_containers_operations.py index 4c288996f15d..5075ed4c0db0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_containers_operations import ( build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, @@ -46,7 +44,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,7 +85,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2018_02_01.models.ListContainerItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +107,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +120,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListContainerItems", pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -236,7 +233,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2018_02_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -271,7 +268,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -285,7 +281,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -395,7 +391,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2018_02_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -430,7 +426,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -444,7 +439,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -473,7 +468,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2018_02_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -496,7 +491,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -510,7 +504,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -518,9 +512,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -539,7 +531,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -562,7 +554,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -685,7 +676,7 @@ async def set_legal_hold( :rtype: ~azure.mgmt.storage.v2018_02_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -720,7 +711,6 @@ async def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -734,7 +724,7 @@ async def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -844,7 +834,7 @@ async def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2018_02_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -879,7 +869,6 @@ async def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -893,7 +882,7 @@ async def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1032,7 +1021,7 @@ async def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_02_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1072,7 +1061,6 @@ async def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1089,7 +1077,7 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1132,7 +1120,7 @@ async def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_02_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1157,7 +1145,6 @@ async def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1174,7 +1161,7 @@ async def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1219,7 +1206,7 @@ async def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_02_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1244,7 +1231,6 @@ async def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1261,7 +1247,7 @@ async def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1295,7 +1281,7 @@ async def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_02_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1319,7 +1305,6 @@ async def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1336,7 +1321,7 @@ async def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1466,7 +1451,7 @@ async def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_02_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1505,7 +1490,6 @@ async def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1522,7 +1506,7 @@ async def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1632,7 +1616,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2018_02_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1670,7 +1654,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1684,7 +1667,7 @@ async def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_operations.py index 4b9f60bd2d31..8ab5631ea141 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_skus_operations.py index f3a499e5ee7e..eb14707d9a52 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Sku"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_storage_accounts_operations.py index 4374c44dffd1..8d4dd7fa4836 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_check_name_availability_request, build_create_request, @@ -49,7 +49,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -132,7 +132,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2018_02_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +164,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -178,7 +177,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -191,8 +190,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -205,7 +204,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -226,10 +225,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -237,12 +236,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -368,10 +369,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -394,9 +396,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -410,7 +410,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -432,7 +432,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -468,7 +467,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2018_02_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -490,7 +489,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -504,7 +502,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -615,7 +613,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2018_02_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -649,7 +647,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -663,7 +660,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -686,7 +683,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -703,7 +700,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -719,7 +715,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -769,7 +764,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -787,7 +782,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -803,7 +797,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -849,7 +842,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2018_02_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -871,7 +864,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -885,7 +877,7 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -978,7 +970,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2018_02_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1012,7 +1004,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1026,7 +1017,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1117,7 +1108,7 @@ async def list_account_sas( :rtype: ~azure.mgmt.storage.v2018_02_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1151,7 +1142,6 @@ async def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1165,7 +1155,7 @@ async def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1254,7 +1244,7 @@ async def list_service_sas( :rtype: ~azure.mgmt.storage.v2018_02_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1288,7 +1278,6 @@ async def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1302,7 +1291,7 @@ async def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_usage_operations.py index 778f859d29d6..5e362335e9e5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/aio/operations/_usage_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usage_operations import build_list_by_location_request, build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Usage"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -151,7 +146,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_mode api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -169,7 +164,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -185,7 +179,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/__init__.py index e3075feed5ec..8308de22c941 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/__init__.py @@ -5,87 +5,98 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccountSasParameters -from ._models_py3 import AzureEntityResource -from ._models_py3 import BlobContainer -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CustomDomain -from ._models_py3 import Dimension -from ._models_py3 import Encryption -from ._models_py3 import EncryptionService -from ._models_py3 import EncryptionServices -from ._models_py3 import Endpoints -from ._models_py3 import IPRule -from ._models_py3 import Identity -from ._models_py3 import ImmutabilityPolicy -from ._models_py3 import ImmutabilityPolicyProperties -from ._models_py3 import KeyVaultProperties -from ._models_py3 import LeaseContainerRequest -from ._models_py3 import LeaseContainerResponse -from ._models_py3 import LegalHold -from ._models_py3 import LegalHoldProperties -from ._models_py3 import ListAccountSasResponse -from ._models_py3 import ListContainerItem -from ._models_py3 import ListContainerItems -from ._models_py3 import ListServiceSasResponse -from ._models_py3 import MetricSpecification -from ._models_py3 import NetworkRuleSet -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import Resource -from ._models_py3 import Restriction -from ._models_py3 import SKUCapability -from ._models_py3 import ServiceSasParameters -from ._models_py3 import ServiceSpecification -from ._models_py3 import Sku -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountKey -from ._models_py3 import StorageAccountListKeysResult -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import StorageSkuListResult -from ._models_py3 import TagProperty -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateHistoryProperty -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._storage_management_client_enums import AccessTier -from ._storage_management_client_enums import AccountStatus -from ._storage_management_client_enums import Bypass -from ._storage_management_client_enums import DefaultAction -from ._storage_management_client_enums import Enum12 -from ._storage_management_client_enums import HttpProtocol -from ._storage_management_client_enums import ImmutabilityPolicyState -from ._storage_management_client_enums import ImmutabilityPolicyUpdateType -from ._storage_management_client_enums import KeyPermission -from ._storage_management_client_enums import KeySource -from ._storage_management_client_enums import Kind -from ._storage_management_client_enums import LeaseContainerRequestAction -from ._storage_management_client_enums import LeaseDuration -from ._storage_management_client_enums import LeaseState -from ._storage_management_client_enums import LeaseStatus -from ._storage_management_client_enums import Permissions -from ._storage_management_client_enums import ProvisioningState -from ._storage_management_client_enums import PublicAccess -from ._storage_management_client_enums import Reason -from ._storage_management_client_enums import ReasonCode -from ._storage_management_client_enums import Services -from ._storage_management_client_enums import SignedResource -from ._storage_management_client_enums import SignedResourceTypes -from ._storage_management_client_enums import SkuName -from ._storage_management_client_enums import SkuTier -from ._storage_management_client_enums import State -from ._storage_management_client_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccountSasParameters, + AzureEntityResource, + BlobContainer, + CheckNameAvailabilityResult, + CustomDomain, + Dimension, + Encryption, + EncryptionService, + EncryptionServices, + Endpoints, + IPRule, + Identity, + ImmutabilityPolicy, + ImmutabilityPolicyProperties, + KeyVaultProperties, + LeaseContainerRequest, + LeaseContainerResponse, + LegalHold, + LegalHoldProperties, + ListAccountSasResponse, + ListContainerItem, + ListContainerItems, + ListServiceSasResponse, + MetricSpecification, + NetworkRuleSet, + Operation, + OperationDisplay, + OperationListResult, + Resource, + Restriction, + SKUCapability, + ServiceSasParameters, + ServiceSpecification, + Sku, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountKey, + StorageAccountListKeysResult, + StorageAccountListResult, + StorageAccountRegenerateKeyParameters, + StorageAccountUpdateParameters, + StorageSkuListResult, + TagProperty, + TrackedResource, + UpdateHistoryProperty, + Usage, + UsageListResult, + UsageName, + VirtualNetworkRule, +) + +from ._storage_management_client_enums import ( # type: ignore + AccessTier, + AccountStatus, + Bypass, + DefaultAction, + Enum12, + HttpProtocol, + ImmutabilityPolicyState, + ImmutabilityPolicyUpdateType, + KeyPermission, + KeySource, + Kind, + LeaseContainerRequestAction, + LeaseDuration, + LeaseState, + LeaseStatus, + Permissions, + ProvisioningState, + PublicAccess, + Reason, + ReasonCode, + Services, + SignedResource, + SignedResourceTypes, + SkuName, + SkuTier, + State, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -167,5 +178,5 @@ "State", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/_models_py3.py index 2ce6bcde5fb9..45b00f1c2ca6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,7 +13,6 @@ from ... import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -191,7 +190,7 @@ def __init__(self, **kwargs: Any) -> None: self.etag = None -class BlobContainer(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class BlobContainer(AzureEntityResource): """Properties of the blob container, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -794,7 +793,7 @@ class LeaseContainerRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2018_02_01.models.LeaseContainerRequestAction :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -833,7 +832,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2018_02_01.models.LeaseContainerRequestAction :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -979,7 +978,7 @@ def __init__(self, **kwargs: Any) -> None: self.account_sas_token = None -class ListContainerItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class ListContainerItem(AzureEntityResource): """The blob container properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -1425,7 +1424,7 @@ def __init__(self, *, reason_code: Optional[Union[str, "_models.ReasonCode"]] = self.reason_code = reason_code -class ServiceSasParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ServiceSasParameters(_serialization.Model): """The parameters to list service SAS credentials of a specific resource. All required parameters must be populated in order to send to server. @@ -1768,7 +1767,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class StorageAccount(TrackedResource): # pylint: disable=too-many-instance-attributes +class StorageAccount(TrackedResource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. @@ -1966,7 +1965,7 @@ def __init__(self, *, name: str, **kwargs: Any) -> None: self.name = name -class StorageAccountCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountCreateParameters(_serialization.Model): """The parameters used when creating a storage account. All required parameters must be populated in order to send to server. diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/_storage_management_client_enums.py index 8ef62cd2100f..63b3d0d7b870 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/_storage_management_client_enums.py @@ -106,6 +106,7 @@ class LeaseContainerRequestAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/__init__.py index abe747aa8c96..75b3760133ed 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._usage_operations import UsageOperations -from ._blob_containers_operations import BlobContainersOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usage_operations import UsageOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -23,5 +29,5 @@ "UsageOperations", "BlobContainersOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_blob_containers_operations.py index b4164e4d9bfd..88299f7715f7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -573,7 +571,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2018_02_01.models.ListContainerItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -595,7 +593,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -609,7 +606,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListContainerItems", pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -722,7 +719,7 @@ def create( :rtype: ~azure.mgmt.storage.v2018_02_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -757,7 +754,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -771,7 +767,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -881,7 +877,7 @@ def update( :rtype: ~azure.mgmt.storage.v2018_02_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -916,7 +912,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -930,7 +925,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -959,7 +954,7 @@ def get( :rtype: ~azure.mgmt.storage.v2018_02_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -982,7 +977,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -996,7 +990,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1025,7 +1019,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1048,7 +1042,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1171,7 +1164,7 @@ def set_legal_hold( :rtype: ~azure.mgmt.storage.v2018_02_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1206,7 +1199,6 @@ def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1220,7 +1212,7 @@ def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1330,7 +1322,7 @@ def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2018_02_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1365,7 +1357,6 @@ def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1379,7 +1370,7 @@ def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1518,7 +1509,7 @@ def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_02_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1558,7 +1549,6 @@ def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1575,7 +1565,7 @@ def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1618,7 +1608,7 @@ def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_02_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1643,7 +1633,6 @@ def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1660,7 +1649,7 @@ def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1705,7 +1694,7 @@ def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_02_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1730,7 +1719,6 @@ def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1747,7 +1735,7 @@ def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1781,7 +1769,7 @@ def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_02_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1805,7 +1793,6 @@ def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1822,7 +1809,7 @@ def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1952,7 +1939,7 @@ def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_02_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1991,7 +1978,6 @@ def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2008,7 +1994,7 @@ def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2118,7 +2104,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2018_02_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2156,7 +2142,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2170,7 +2155,7 @@ def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_operations.py index 2aaa9ffd0c59..8518c6073d36 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -126,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_skus_operations.py index 5640f4fb58c0..40fbb7f78e6a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Sku"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_storage_accounts_operations.py index 8095a41ba83c..484179b75667 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -478,7 +478,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2018_02_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -510,7 +510,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -524,7 +523,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -537,8 +536,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -551,7 +550,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -572,10 +571,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -583,12 +582,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -711,10 +712,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -753,7 +755,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -775,7 +777,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -809,7 +810,7 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: :rtype: ~azure.mgmt.storage.v2018_02_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -831,7 +832,6 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -845,7 +845,7 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -956,7 +956,7 @@ def update( :rtype: ~azure.mgmt.storage.v2018_02_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -990,7 +990,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1004,7 +1003,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1026,7 +1025,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1043,7 +1042,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1059,7 +1057,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1106,7 +1103,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1124,7 +1121,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1140,7 +1136,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1186,7 +1181,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2018_02_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1208,7 +1203,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1222,7 +1216,7 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1315,7 +1309,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2018_02_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1349,7 +1343,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1363,7 +1356,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1454,7 +1447,7 @@ def list_account_sas( :rtype: ~azure.mgmt.storage.v2018_02_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1488,7 +1481,6 @@ def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1502,7 +1494,7 @@ def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1591,7 +1583,7 @@ def list_service_sas( :rtype: ~azure.mgmt.storage.v2018_02_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1625,7 +1617,6 @@ def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1639,7 +1630,7 @@ def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_usage_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_usage_operations.py index ed94dc23643c..54efe879dd2e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_usage_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/operations/_usage_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -126,7 +123,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Usage"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -143,7 +140,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -159,7 +155,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -205,7 +200,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.Us api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-02-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -223,7 +218,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -239,7 +233,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/__init__.py index a860a5c185c9..60980065e1ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_configuration.py index 9c94ede524e1..04b1a33e69e7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_metadata.json index d82b92dd9c83..fae3912c18a9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_storage_management_client.py index 98db49918487..c8fa9219779f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -27,11 +28,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -138,7 +138,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_version.py index 83bf7bbed684..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/__init__.py index a5c3d2414cfd..ee2b940bd4fc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/_configuration.py index 43c808293f5d..02f3c47ba57f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/_storage_management_client.py index 203d5689a2d4..660c3caa08d5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -27,11 +28,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -140,7 +140,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/__init__.py index f701c9204162..20a9703954a4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/__init__.py @@ -5,16 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._usages_operations import UsagesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._management_policies_operations import ManagementPoliciesOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -25,5 +31,5 @@ "BlobContainersOperations", "ManagementPoliciesOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_blob_containers_operations.py index d8ef78c498f3..45d87068339c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_containers_operations import ( build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, @@ -46,7 +44,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,7 +85,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.ListContainerItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -111,7 +109,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -125,7 +122,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListContainerItems", pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -238,7 +235,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -275,7 +272,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -289,7 +285,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -399,7 +395,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -436,7 +432,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -450,7 +445,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -479,7 +474,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +499,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -518,7 +512,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -526,9 +520,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -547,7 +539,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -572,7 +564,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -695,7 +686,7 @@ async def set_legal_hold( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -732,7 +723,6 @@ async def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -746,7 +736,7 @@ async def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -856,7 +846,7 @@ async def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -893,7 +883,6 @@ async def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -907,7 +896,7 @@ async def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1047,7 +1036,7 @@ async def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1089,7 +1078,6 @@ async def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1106,7 +1094,7 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1149,7 +1137,7 @@ async def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1176,7 +1164,6 @@ async def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1193,7 +1180,7 @@ async def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1238,7 +1225,7 @@ async def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1265,7 +1252,6 @@ async def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1282,7 +1268,7 @@ async def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1316,7 +1302,7 @@ async def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1342,7 +1328,6 @@ async def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1359,7 +1344,7 @@ async def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1490,7 +1475,7 @@ async def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1531,7 +1516,6 @@ async def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1548,7 +1532,7 @@ async def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1659,7 +1643,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1699,7 +1683,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1713,7 +1696,7 @@ async def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_management_policies_operations.py index e7ae883d9ff7..57217b3022f7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._management_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountManagementPolicies :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -111,7 +108,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -125,7 +121,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountManagementPolicies", pipeline_response) + deserialized = self._deserialize("StorageAccountManagementPolicies", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -231,7 +227,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountManagementPolicies :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -268,7 +264,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -282,7 +277,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountManagementPolicies", pipeline_response) + deserialized = self._deserialize("StorageAccountManagementPolicies", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -290,7 +285,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -314,7 +309,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -339,7 +334,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_operations.py index 92a62bfb9fe1..1ed0310720d8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +72,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +88,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -107,7 +103,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_skus_operations.py index 627727bca5db..03aa7f49b857 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +72,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Sku"]: ) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -92,7 +89,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -108,7 +104,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_storage_accounts_operations.py index 206e5dcdd6ce..3954d594ff10 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_check_name_availability_request, build_create_or_update_management_policies_request, @@ -52,7 +52,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -135,7 +135,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -169,7 +169,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -183,7 +182,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -196,8 +195,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -212,7 +211,7 @@ async def _create_initial( "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -233,10 +232,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -244,12 +243,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -377,10 +378,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -403,9 +405,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -419,7 +419,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -443,7 +443,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -479,7 +478,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -503,7 +502,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -517,7 +515,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -628,7 +626,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -664,7 +662,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -678,7 +675,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -703,7 +700,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: ) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -720,7 +717,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -736,7 +732,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -788,7 +783,7 @@ def list_by_resource_group( ) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -806,7 +801,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -822,7 +816,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -868,7 +861,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -892,7 +885,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -906,7 +898,7 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1000,7 +992,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1036,7 +1028,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1050,7 +1041,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1142,7 +1133,7 @@ async def list_account_sas( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1178,7 +1169,6 @@ async def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1192,7 +1182,7 @@ async def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1282,7 +1272,7 @@ async def list_service_sas( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1318,7 +1308,6 @@ async def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1332,7 +1321,7 @@ async def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1364,7 +1353,7 @@ async def get_management_policies( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountManagementPolicies :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1389,7 +1378,6 @@ async def get_management_policies( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1403,7 +1391,7 @@ async def get_management_policies( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountManagementPolicies", pipeline_response) + deserialized = self._deserialize("StorageAccountManagementPolicies", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1509,7 +1497,7 @@ async def create_or_update_management_policies( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountManagementPolicies :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1546,7 +1534,6 @@ async def create_or_update_management_policies( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1560,7 +1547,7 @@ async def create_or_update_management_policies( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountManagementPolicies", pipeline_response) + deserialized = self._deserialize("StorageAccountManagementPolicies", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1568,7 +1555,7 @@ async def create_or_update_management_policies( return deserialized # type: ignore @distributed_trace_async - async def delete_management_policies( # pylint: disable=inconsistent-return-statements + async def delete_management_policies( self, resource_group_name: str, account_name: str, @@ -1592,7 +1579,7 @@ async def delete_management_policies( # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1617,7 +1604,6 @@ async def delete_management_policies( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_usages_operations.py index 5caa94145772..bf23d585d448 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/aio/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usages_operations import build_list_by_location_request, build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +72,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Usage"]: ) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -92,7 +89,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -108,7 +104,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -157,7 +152,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_mode ) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,7 +170,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -191,7 +185,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/__init__.py index 85e8f71e5eaa..267308b261f2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/__init__.py @@ -5,92 +5,103 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccountSasParameters -from ._models_py3 import AzureEntityResource -from ._models_py3 import BlobContainer -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CustomDomain -from ._models_py3 import Dimension -from ._models_py3 import Encryption -from ._models_py3 import EncryptionService -from ._models_py3 import EncryptionServices -from ._models_py3 import Endpoints -from ._models_py3 import IPRule -from ._models_py3 import Identity -from ._models_py3 import ImmutabilityPolicy -from ._models_py3 import ImmutabilityPolicyProperties -from ._models_py3 import KeyVaultProperties -from ._models_py3 import LeaseContainerRequest -from ._models_py3 import LeaseContainerResponse -from ._models_py3 import LegalHold -from ._models_py3 import LegalHoldProperties -from ._models_py3 import ListAccountSasResponse -from ._models_py3 import ListContainerItem -from ._models_py3 import ListContainerItems -from ._models_py3 import ListServiceSasResponse -from ._models_py3 import ManagementPoliciesRules -from ._models_py3 import ManagementPoliciesRulesSetParameter -from ._models_py3 import MetricSpecification -from ._models_py3 import NetworkRuleSet -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import Resource -from ._models_py3 import Restriction -from ._models_py3 import SKUCapability -from ._models_py3 import ServiceSasParameters -from ._models_py3 import ServiceSpecification -from ._models_py3 import Sku -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountKey -from ._models_py3 import StorageAccountListKeysResult -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountManagementPolicies -from ._models_py3 import StorageAccountManagementPoliciesRulesProperty -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import StorageSkuListResult -from ._models_py3 import TagProperty -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateHistoryProperty -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._storage_management_client_enums import AccessTier -from ._storage_management_client_enums import AccountStatus -from ._storage_management_client_enums import Bypass -from ._storage_management_client_enums import DefaultAction -from ._storage_management_client_enums import Enum13 -from ._storage_management_client_enums import HttpProtocol -from ._storage_management_client_enums import ImmutabilityPolicyState -from ._storage_management_client_enums import ImmutabilityPolicyUpdateType -from ._storage_management_client_enums import KeyPermission -from ._storage_management_client_enums import KeySource -from ._storage_management_client_enums import Kind -from ._storage_management_client_enums import LeaseContainerRequestAction -from ._storage_management_client_enums import LeaseDuration -from ._storage_management_client_enums import LeaseState -from ._storage_management_client_enums import LeaseStatus -from ._storage_management_client_enums import ManagementPolicyName -from ._storage_management_client_enums import Permissions -from ._storage_management_client_enums import ProvisioningState -from ._storage_management_client_enums import PublicAccess -from ._storage_management_client_enums import Reason -from ._storage_management_client_enums import ReasonCode -from ._storage_management_client_enums import Services -from ._storage_management_client_enums import SignedResource -from ._storage_management_client_enums import SignedResourceTypes -from ._storage_management_client_enums import SkuName -from ._storage_management_client_enums import SkuTier -from ._storage_management_client_enums import State -from ._storage_management_client_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccountSasParameters, + AzureEntityResource, + BlobContainer, + CheckNameAvailabilityResult, + CustomDomain, + Dimension, + Encryption, + EncryptionService, + EncryptionServices, + Endpoints, + IPRule, + Identity, + ImmutabilityPolicy, + ImmutabilityPolicyProperties, + KeyVaultProperties, + LeaseContainerRequest, + LeaseContainerResponse, + LegalHold, + LegalHoldProperties, + ListAccountSasResponse, + ListContainerItem, + ListContainerItems, + ListServiceSasResponse, + ManagementPoliciesRules, + ManagementPoliciesRulesSetParameter, + MetricSpecification, + NetworkRuleSet, + Operation, + OperationDisplay, + OperationListResult, + Resource, + Restriction, + SKUCapability, + ServiceSasParameters, + ServiceSpecification, + Sku, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountKey, + StorageAccountListKeysResult, + StorageAccountListResult, + StorageAccountManagementPolicies, + StorageAccountManagementPoliciesRulesProperty, + StorageAccountRegenerateKeyParameters, + StorageAccountUpdateParameters, + StorageSkuListResult, + TagProperty, + TrackedResource, + UpdateHistoryProperty, + Usage, + UsageListResult, + UsageName, + VirtualNetworkRule, +) + +from ._storage_management_client_enums import ( # type: ignore + AccessTier, + AccountStatus, + Bypass, + DefaultAction, + Enum13, + HttpProtocol, + ImmutabilityPolicyState, + ImmutabilityPolicyUpdateType, + KeyPermission, + KeySource, + Kind, + LeaseContainerRequestAction, + LeaseDuration, + LeaseState, + LeaseStatus, + ManagementPolicyName, + Permissions, + ProvisioningState, + PublicAccess, + Reason, + ReasonCode, + Services, + SignedResource, + SignedResourceTypes, + SkuName, + SkuTier, + State, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -177,5 +188,5 @@ "State", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_models_py3.py index 9ca85d76f85c..79eadfdb5916 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -16,10 +16,9 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -200,7 +199,7 @@ def __init__(self, **kwargs: Any) -> None: self.etag = None -class BlobContainer(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class BlobContainer(AzureEntityResource): """Properties of the blob container, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -806,7 +805,7 @@ class LeaseContainerRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2018_03_01_preview.models.LeaseContainerRequestAction :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. @@ -846,7 +845,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2018_03_01_preview.models.LeaseContainerRequestAction :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. @@ -993,7 +992,7 @@ def __init__(self, **kwargs: Any) -> None: self.account_sas_token = None -class ListContainerItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class ListContainerItem(AzureEntityResource): """The blob container properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -1488,7 +1487,7 @@ def __init__(self, *, reason_code: Optional[Union[str, "_models.ReasonCode"]] = self.reason_code = reason_code -class ServiceSasParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ServiceSasParameters(_serialization.Model): """The parameters to list service SAS credentials of a specific resource. All required parameters must be populated in order to send to server. @@ -1831,7 +1830,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class StorageAccount(TrackedResource): # pylint: disable=too-many-instance-attributes +class StorageAccount(TrackedResource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. @@ -2031,7 +2030,7 @@ def __init__(self, *, name: str, **kwargs: Any) -> None: self.name = name -class StorageAccountCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountCreateParameters(_serialization.Model): """The parameters used when creating a storage account. All required parameters must be populated in order to send to server. diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_storage_management_client_enums.py index 67ac5d08d6fc..791d36adcf7e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_storage_management_client_enums.py @@ -106,6 +106,7 @@ class LeaseContainerRequestAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/__init__.py index f701c9204162..20a9703954a4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/__init__.py @@ -5,16 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._usages_operations import UsagesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._management_policies_operations import ManagementPoliciesOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -25,5 +31,5 @@ "BlobContainersOperations", "ManagementPoliciesOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_blob_containers_operations.py index ecff71203244..3f43ca5dc8fb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -573,7 +571,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.ListContainerItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -597,7 +595,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -611,7 +608,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListContainerItems", pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -724,7 +721,7 @@ def create( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -761,7 +758,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -775,7 +771,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -885,7 +881,7 @@ def update( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -922,7 +918,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -936,7 +931,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -965,7 +960,7 @@ def get( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -990,7 +985,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1004,7 +998,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1033,7 +1027,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1058,7 +1052,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1181,7 +1174,7 @@ def set_legal_hold( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1218,7 +1211,6 @@ def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1232,7 +1224,7 @@ def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1342,7 +1334,7 @@ def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1379,7 +1371,6 @@ def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1393,7 +1384,7 @@ def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1533,7 +1524,7 @@ def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1575,7 +1566,6 @@ def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1592,7 +1582,7 @@ def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1635,7 +1625,7 @@ def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1662,7 +1652,6 @@ def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1679,7 +1668,7 @@ def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1724,7 +1713,7 @@ def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1751,7 +1740,6 @@ def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1768,7 +1756,7 @@ def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1802,7 +1790,7 @@ def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1828,7 +1816,6 @@ def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1845,7 +1832,7 @@ def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1976,7 +1963,7 @@ def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2017,7 +2004,6 @@ def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2034,7 +2020,7 @@ def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2145,7 +2131,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2185,7 +2171,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2199,7 +2184,7 @@ def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_management_policies_operations.py index 777ed8680d1b..a9afaec7a36a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -196,7 +193,7 @@ def get( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountManagementPolicies :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -221,7 +218,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -235,7 +231,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountManagementPolicies", pipeline_response) + deserialized = self._deserialize("StorageAccountManagementPolicies", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -341,7 +337,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountManagementPolicies :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -378,7 +374,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -392,7 +387,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountManagementPolicies", pipeline_response) + deserialized = self._deserialize("StorageAccountManagementPolicies", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -424,7 +419,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -449,7 +444,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_operations.py index d71ba6b97aca..5f543c052e60 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -96,7 +93,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,7 +109,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -128,7 +124,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_skus_operations.py index 787e21154230..fbbd6da4054d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -101,7 +98,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Sku"]: ) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -118,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -134,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_storage_accounts_operations.py index 29f8bbd371ee..52908febfe4b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -589,7 +589,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -623,7 +623,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -637,7 +636,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -650,8 +649,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -666,7 +665,7 @@ def _create_initial( "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -687,10 +686,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -698,12 +697,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -831,10 +832,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -873,7 +875,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -897,7 +899,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -931,7 +932,7 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -955,7 +956,6 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -969,7 +969,7 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1080,7 +1080,7 @@ def update( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1116,7 +1116,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1130,7 +1129,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1155,7 +1154,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: ) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1172,7 +1171,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1188,7 +1186,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1238,7 +1235,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite ) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1256,7 +1253,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1272,7 +1268,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1318,7 +1313,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1342,7 +1337,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1356,7 +1350,7 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1450,7 +1444,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1486,7 +1480,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1500,7 +1493,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1592,7 +1585,7 @@ def list_account_sas( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1628,7 +1621,6 @@ def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1642,7 +1634,7 @@ def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1732,7 +1724,7 @@ def list_service_sas( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1768,7 +1760,6 @@ def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1782,7 +1773,7 @@ def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1814,7 +1805,7 @@ def get_management_policies( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountManagementPolicies :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1839,7 +1830,6 @@ def get_management_policies( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1853,7 +1843,7 @@ def get_management_policies( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountManagementPolicies", pipeline_response) + deserialized = self._deserialize("StorageAccountManagementPolicies", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1959,7 +1949,7 @@ def create_or_update_management_policies( :rtype: ~azure.mgmt.storage.v2018_03_01_preview.models.StorageAccountManagementPolicies :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1996,7 +1986,6 @@ def create_or_update_management_policies( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2010,7 +1999,7 @@ def create_or_update_management_policies( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountManagementPolicies", pipeline_response) + deserialized = self._deserialize("StorageAccountManagementPolicies", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2042,7 +2031,7 @@ def delete_management_policies( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2067,7 +2056,6 @@ def delete_management_policies( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_usages_operations.py index c8b444c05815..55523316cc07 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -128,7 +125,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Usage"]: ) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -145,7 +142,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -161,7 +157,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -209,7 +204,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.Us ) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +222,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -243,7 +237,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/__init__.py index a860a5c185c9..60980065e1ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_configuration.py index 48876935caba..3dbc4307f975 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_metadata.json index d557e44445ef..5fd828b2329b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_storage_management_client.py index aa238335366a..2602ab1e9537 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -27,11 +28,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -131,7 +131,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_version.py index 5a163c0afedc..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" \ No newline at end of file +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/__init__.py index a5c3d2414cfd..ee2b940bd4fc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/_configuration.py index 9834f6fcca65..9c0a1ab0fdb4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/_storage_management_client.py index 21b109512895..d367ceec7c66 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -27,11 +28,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword +class StorageManagementClient: """The Azure Storage Management API. :ivar operations: Operations operations @@ -135,7 +135,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/__init__.py index d54538e70fca..2904c4bb3f14 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/__init__.py @@ -5,16 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._usages_operations import UsagesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -25,5 +31,5 @@ "BlobServicesOperations", "BlobContainersOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_blob_containers_operations.py index 5a367dbd3d97..b1f019d7358d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_containers_operations import ( build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, @@ -46,7 +44,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,7 +85,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2018_07_01.models.ListContainerItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +107,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +120,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListContainerItems", pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -236,7 +233,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2018_07_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -271,7 +268,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -285,7 +281,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -395,7 +391,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2018_07_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -430,7 +426,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -444,7 +439,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -473,7 +468,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2018_07_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -496,7 +491,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -510,7 +504,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -518,9 +512,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -539,7 +531,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -562,7 +554,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -685,7 +676,7 @@ async def set_legal_hold( :rtype: ~azure.mgmt.storage.v2018_07_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -720,7 +711,6 @@ async def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -734,7 +724,7 @@ async def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -844,7 +834,7 @@ async def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2018_07_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -879,7 +869,6 @@ async def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -893,7 +882,7 @@ async def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1032,7 +1021,7 @@ async def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_07_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1072,7 +1061,6 @@ async def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1089,7 +1077,7 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1132,7 +1120,7 @@ async def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_07_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1157,7 +1145,6 @@ async def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1174,7 +1161,7 @@ async def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1219,7 +1206,7 @@ async def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_07_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1244,7 +1231,6 @@ async def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1261,7 +1247,7 @@ async def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1295,7 +1281,7 @@ async def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_07_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1319,7 +1305,6 @@ async def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1336,7 +1321,7 @@ async def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1466,7 +1451,7 @@ async def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_07_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1505,7 +1490,6 @@ async def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1522,7 +1506,7 @@ async def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1632,7 +1616,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2018_07_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1670,7 +1654,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1684,7 +1667,7 @@ async def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_blob_services_operations.py index 18698bdd55ae..bf5893df178d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_services_operations import ( build_get_service_properties_request, build_set_service_properties_request, @@ -35,7 +32,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -160,7 +157,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2018_07_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -195,7 +192,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -209,7 +205,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -237,7 +233,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2018_07_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,7 +256,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -274,7 +269,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_operations.py index 5f4934670d7c..ba86951d4909 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_skus_operations.py index 1ab41a9c5ad3..2940d1170d6f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Sku"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_storage_accounts_operations.py index 6ffafa121ada..0321bc69342f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_check_name_availability_request, build_create_request, @@ -50,7 +63,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -133,7 +146,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2018_07_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -165,7 +178,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -179,7 +191,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -192,8 +204,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -206,7 +218,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -227,10 +239,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -238,12 +250,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -369,10 +383,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -395,9 +410,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -411,7 +424,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -433,7 +446,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -477,7 +489,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2018_07_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -500,7 +512,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -514,7 +525,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -625,7 +636,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2018_07_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -659,7 +670,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -673,7 +683,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -696,7 +706,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -713,7 +723,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -729,7 +738,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -779,7 +787,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -797,7 +805,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -813,7 +820,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -859,7 +865,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2018_07_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -881,7 +887,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -895,7 +900,7 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -988,7 +993,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2018_07_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1022,7 +1027,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1036,7 +1040,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1127,7 +1131,7 @@ async def list_account_sas( :rtype: ~azure.mgmt.storage.v2018_07_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1161,7 +1165,6 @@ async def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1175,7 +1178,7 @@ async def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1264,7 +1267,7 @@ async def list_service_sas( :rtype: ~azure.mgmt.storage.v2018_07_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1298,7 +1301,6 @@ async def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1312,17 +1314,17 @@ async def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _failover_initial( # pylint: disable=inconsistent-return-statements + async def _failover_initial( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1334,7 +1336,7 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1344,10 +1346,10 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1355,11 +1357,19 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1387,7 +1397,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._failover_initial( # type: ignore + raw_result = await self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1396,6 +1406,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_usages_operations.py index eace551a20fc..66c647819224 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/aio/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usages_operations import build_list_by_location_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +72,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_mode api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -109,7 +105,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/__init__.py index 6646e7851c0f..e3cd747185aa 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/__init__.py @@ -5,94 +5,105 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccountSasParameters -from ._models_py3 import AzureEntityResource -from ._models_py3 import BlobContainer -from ._models_py3 import BlobServiceProperties -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CorsRule -from ._models_py3 import CorsRules -from ._models_py3 import CustomDomain -from ._models_py3 import DeleteRetentionPolicy -from ._models_py3 import Dimension -from ._models_py3 import Encryption -from ._models_py3 import EncryptionService -from ._models_py3 import EncryptionServices -from ._models_py3 import Endpoints -from ._models_py3 import GeoReplicationStats -from ._models_py3 import IPRule -from ._models_py3 import Identity -from ._models_py3 import ImmutabilityPolicy -from ._models_py3 import ImmutabilityPolicyProperties -from ._models_py3 import KeyVaultProperties -from ._models_py3 import LeaseContainerRequest -from ._models_py3 import LeaseContainerResponse -from ._models_py3 import LegalHold -from ._models_py3 import LegalHoldProperties -from ._models_py3 import ListAccountSasResponse -from ._models_py3 import ListContainerItem -from ._models_py3 import ListContainerItems -from ._models_py3 import ListServiceSasResponse -from ._models_py3 import MetricSpecification -from ._models_py3 import NetworkRuleSet -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import Resource -from ._models_py3 import Restriction -from ._models_py3 import SKUCapability -from ._models_py3 import ServiceSasParameters -from ._models_py3 import ServiceSpecification -from ._models_py3 import Sku -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountKey -from ._models_py3 import StorageAccountListKeysResult -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import StorageSkuListResult -from ._models_py3 import TagProperty -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateHistoryProperty -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._storage_management_client_enums import AccessTier -from ._storage_management_client_enums import AccountStatus -from ._storage_management_client_enums import Bypass -from ._storage_management_client_enums import CorsRuleAllowedMethodsItem -from ._storage_management_client_enums import DefaultAction -from ._storage_management_client_enums import Enum8 -from ._storage_management_client_enums import GeoReplicationStatus -from ._storage_management_client_enums import HttpProtocol -from ._storage_management_client_enums import ImmutabilityPolicyState -from ._storage_management_client_enums import ImmutabilityPolicyUpdateType -from ._storage_management_client_enums import KeyPermission -from ._storage_management_client_enums import KeySource -from ._storage_management_client_enums import Kind -from ._storage_management_client_enums import LeaseContainerRequestAction -from ._storage_management_client_enums import LeaseDuration -from ._storage_management_client_enums import LeaseState -from ._storage_management_client_enums import LeaseStatus -from ._storage_management_client_enums import Permissions -from ._storage_management_client_enums import ProvisioningState -from ._storage_management_client_enums import PublicAccess -from ._storage_management_client_enums import Reason -from ._storage_management_client_enums import ReasonCode -from ._storage_management_client_enums import Services -from ._storage_management_client_enums import SignedResource -from ._storage_management_client_enums import SignedResourceTypes -from ._storage_management_client_enums import SkuName -from ._storage_management_client_enums import SkuTier -from ._storage_management_client_enums import State -from ._storage_management_client_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccountSasParameters, + AzureEntityResource, + BlobContainer, + BlobServiceProperties, + CheckNameAvailabilityResult, + CorsRule, + CorsRules, + CustomDomain, + DeleteRetentionPolicy, + Dimension, + Encryption, + EncryptionService, + EncryptionServices, + Endpoints, + GeoReplicationStats, + IPRule, + Identity, + ImmutabilityPolicy, + ImmutabilityPolicyProperties, + KeyVaultProperties, + LeaseContainerRequest, + LeaseContainerResponse, + LegalHold, + LegalHoldProperties, + ListAccountSasResponse, + ListContainerItem, + ListContainerItems, + ListServiceSasResponse, + MetricSpecification, + NetworkRuleSet, + Operation, + OperationDisplay, + OperationListResult, + Resource, + Restriction, + SKUCapability, + ServiceSasParameters, + ServiceSpecification, + Sku, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountKey, + StorageAccountListKeysResult, + StorageAccountListResult, + StorageAccountRegenerateKeyParameters, + StorageAccountUpdateParameters, + StorageSkuListResult, + TagProperty, + TrackedResource, + UpdateHistoryProperty, + Usage, + UsageListResult, + UsageName, + VirtualNetworkRule, +) + +from ._storage_management_client_enums import ( # type: ignore + AccessTier, + AccountStatus, + Bypass, + CorsRuleAllowedMethodsItem, + DefaultAction, + Enum8, + GeoReplicationStatus, + HttpProtocol, + ImmutabilityPolicyState, + ImmutabilityPolicyUpdateType, + KeyPermission, + KeySource, + Kind, + LeaseContainerRequestAction, + LeaseDuration, + LeaseState, + LeaseStatus, + Permissions, + ProvisioningState, + PublicAccess, + Reason, + ReasonCode, + Services, + SignedResource, + SignedResourceTypes, + SkuName, + SkuTier, + State, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -181,5 +192,5 @@ "State", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_models_py3.py index 6839e4d3ee54..8962d0ab5477 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,7 +13,6 @@ from ... import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -191,7 +190,7 @@ def __init__(self, **kwargs: Any) -> None: self.etag = None -class BlobContainer(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class BlobContainer(AzureEntityResource): """Properties of the blob container, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -1032,7 +1031,7 @@ class LeaseContainerRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2018_07_01.models.LeaseContainerRequestAction :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -1071,7 +1070,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2018_07_01.models.LeaseContainerRequestAction :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -1217,7 +1216,7 @@ def __init__(self, **kwargs: Any) -> None: self.account_sas_token = None -class ListContainerItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class ListContainerItem(AzureEntityResource): """The blob container properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -1663,7 +1662,7 @@ def __init__(self, *, reason_code: Optional[Union[str, "_models.ReasonCode"]] = self.reason_code = reason_code -class ServiceSasParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ServiceSasParameters(_serialization.Model): """The parameters to list service SAS credentials of a specific resource. All required parameters must be populated in order to send to server. @@ -2008,7 +2007,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class StorageAccount(TrackedResource): # pylint: disable=too-many-instance-attributes +class StorageAccount(TrackedResource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. @@ -2227,7 +2226,7 @@ def __init__(self, *, name: str, **kwargs: Any) -> None: self.name = name -class StorageAccountCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountCreateParameters(_serialization.Model): """The parameters used when creating a storage account. All required parameters must be populated in order to send to server. diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_storage_management_client_enums.py index a4e8084d989b..f7aef6752b0d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_storage_management_client_enums.py @@ -133,6 +133,7 @@ class LeaseContainerRequestAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/__init__.py index d54538e70fca..2904c4bb3f14 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/__init__.py @@ -5,16 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._usages_operations import UsagesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -25,5 +31,5 @@ "BlobServicesOperations", "BlobContainersOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_blob_containers_operations.py index a3435967bdf7..eae8cb8878b8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -573,7 +571,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2018_07_01.models.ListContainerItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -595,7 +593,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -609,7 +606,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListContainerItems", pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -722,7 +719,7 @@ def create( :rtype: ~azure.mgmt.storage.v2018_07_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -757,7 +754,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -771,7 +767,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -881,7 +877,7 @@ def update( :rtype: ~azure.mgmt.storage.v2018_07_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -916,7 +912,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -930,7 +925,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -959,7 +954,7 @@ def get( :rtype: ~azure.mgmt.storage.v2018_07_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -982,7 +977,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -996,7 +990,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1025,7 +1019,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1048,7 +1042,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1171,7 +1164,7 @@ def set_legal_hold( :rtype: ~azure.mgmt.storage.v2018_07_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1206,7 +1199,6 @@ def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1220,7 +1212,7 @@ def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1330,7 +1322,7 @@ def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2018_07_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1365,7 +1357,6 @@ def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1379,7 +1370,7 @@ def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1518,7 +1509,7 @@ def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_07_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1558,7 +1549,6 @@ def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1575,7 +1565,7 @@ def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1618,7 +1608,7 @@ def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_07_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1643,7 +1633,6 @@ def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1660,7 +1649,7 @@ def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1705,7 +1694,7 @@ def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_07_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1730,7 +1719,6 @@ def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1747,7 +1735,7 @@ def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1781,7 +1769,7 @@ def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_07_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1805,7 +1793,6 @@ def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1822,7 +1809,7 @@ def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1952,7 +1939,7 @@ def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_07_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1991,7 +1978,6 @@ def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2008,7 +1994,7 @@ def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2118,7 +2104,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2018_07_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2156,7 +2142,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2170,7 +2155,7 @@ def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_blob_services_operations.py index 3604440e00b4..7c52f13e0ea4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -239,7 +236,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2018_07_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -274,7 +271,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -288,7 +284,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -316,7 +312,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2018_07_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -339,7 +335,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -353,7 +348,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_operations.py index 02ad24fd85b4..f203bc355991 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -126,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_skus_operations.py index 6afe4f9536eb..e0e18401c8eb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Sku"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_storage_accounts_operations.py index f7d741a6c517..8f86a5b56c8e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -512,7 +512,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2018_07_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -544,7 +544,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -558,7 +557,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -571,8 +570,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -585,7 +584,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -606,10 +605,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -617,12 +616,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -745,10 +746,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -787,7 +789,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -809,7 +811,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -853,7 +854,7 @@ def get_properties( :rtype: ~azure.mgmt.storage.v2018_07_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -876,7 +877,6 @@ def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -890,7 +890,7 @@ def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1001,7 +1001,7 @@ def update( :rtype: ~azure.mgmt.storage.v2018_07_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1035,7 +1035,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1049,7 +1048,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1071,7 +1070,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1088,7 +1087,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1104,7 +1102,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1151,7 +1148,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1169,7 +1166,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1185,7 +1181,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1231,7 +1226,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2018_07_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1253,7 +1248,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1267,7 +1261,7 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1360,7 +1354,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2018_07_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1394,7 +1388,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1408,7 +1401,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1499,7 +1492,7 @@ def list_account_sas( :rtype: ~azure.mgmt.storage.v2018_07_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1533,7 +1526,6 @@ def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1547,7 +1539,7 @@ def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1636,7 +1628,7 @@ def list_service_sas( :rtype: ~azure.mgmt.storage.v2018_07_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1670,7 +1662,6 @@ def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1684,17 +1675,15 @@ def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _failover_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _failover_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1706,7 +1695,7 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1716,10 +1705,10 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1727,11 +1716,19 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1759,7 +1756,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._failover_initial( # type: ignore + raw_result = self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1768,6 +1765,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_usages_operations.py index 2ec2533c4e11..a973a1eb6eca 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -105,7 +102,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.Us api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-07-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -139,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/__init__.py index a860a5c185c9..60980065e1ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_configuration.py index 784c1f2f9aa6..45ed9dbb1402 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_metadata.json index 6a389ac15da5..fa4019e790cb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_storage_management_client.py index 5e2e948134ab..7e9962ae03b6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -28,11 +29,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -138,7 +138,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_version.py index 83bf7bbed684..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/__init__.py index a5c3d2414cfd..ee2b940bd4fc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/_configuration.py index 6bd238cf58cb..68f79136b75c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/_storage_management_client.py index ae9f4b66e9fc..ab191cc50cf3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -28,11 +29,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -142,7 +142,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/__init__.py index f845fcd0d9cb..a1c1461e660e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/__init__.py @@ -5,17 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -27,5 +33,5 @@ "BlobServicesOperations", "BlobContainersOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_blob_containers_operations.py index aa39908d0905..4355eaccabce 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_containers_operations import ( build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, @@ -46,7 +44,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,7 +85,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2018_11_01.models.ListContainerItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +107,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +120,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListContainerItems", pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -236,7 +233,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2018_11_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -271,7 +268,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -285,11 +281,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -399,7 +391,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2018_11_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -434,7 +426,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -448,7 +439,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -477,7 +468,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2018_11_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -500,7 +491,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -514,7 +504,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -522,9 +512,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -543,7 +531,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +554,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -689,7 +676,7 @@ async def set_legal_hold( :rtype: ~azure.mgmt.storage.v2018_11_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -724,7 +711,6 @@ async def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -738,7 +724,7 @@ async def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -848,7 +834,7 @@ async def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2018_11_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -883,7 +869,6 @@ async def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -897,7 +882,7 @@ async def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1036,7 +1021,7 @@ async def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_11_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1076,7 +1061,6 @@ async def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1093,7 +1077,7 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1136,7 +1120,7 @@ async def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_11_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1161,7 +1145,6 @@ async def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1178,7 +1161,7 @@ async def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1223,7 +1206,7 @@ async def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_11_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1248,7 +1231,6 @@ async def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1265,7 +1247,7 @@ async def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1299,7 +1281,7 @@ async def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_11_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1323,7 +1305,6 @@ async def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1340,7 +1321,7 @@ async def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1470,7 +1451,7 @@ async def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_11_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1509,7 +1490,6 @@ async def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1526,7 +1506,7 @@ async def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1636,7 +1616,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2018_11_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1674,7 +1654,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1688,7 +1667,7 @@ async def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_blob_services_operations.py index b9af8078f408..1925f2b10ceb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_services_operations import ( build_get_service_properties_request, build_set_service_properties_request, @@ -35,7 +32,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -160,7 +157,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2018_11_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -195,7 +192,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -209,7 +205,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -237,7 +233,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2018_11_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,7 +256,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -274,7 +269,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_management_policies_operations.py index e3d3677624de..b68cefbc3c75 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._management_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +119,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -227,7 +223,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -262,7 +258,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -276,7 +271,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -284,7 +279,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -308,7 +303,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +326,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_operations.py index 593395db3ba5..28384b567ccf 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-11-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_skus_operations.py index 8dedcbb34162..9102f46518f5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Sku"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-11-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_storage_accounts_operations.py index 3fce40606370..355aed45f141 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_check_name_availability_request, build_create_request, @@ -51,7 +64,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -134,7 +147,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2018_11_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -166,7 +179,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -180,7 +192,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -193,8 +205,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +219,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -228,10 +240,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -239,12 +251,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -370,10 +384,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -396,9 +411,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -412,7 +425,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -434,7 +447,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -478,7 +490,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2018_11_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -501,7 +513,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -515,7 +526,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -626,7 +637,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2018_11_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -660,7 +671,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -674,7 +684,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -697,7 +707,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-11-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -714,7 +724,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -730,7 +739,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -780,7 +788,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-11-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -798,7 +806,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -814,7 +821,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -860,7 +866,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2018_11_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -882,7 +888,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -896,7 +901,7 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -989,7 +994,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2018_11_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1023,7 +1028,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1037,7 +1041,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1128,7 +1132,7 @@ async def list_account_sas( :rtype: ~azure.mgmt.storage.v2018_11_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1162,7 +1166,6 @@ async def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1176,7 +1179,7 @@ async def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1265,7 +1268,7 @@ async def list_service_sas( :rtype: ~azure.mgmt.storage.v2018_11_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1299,7 +1302,6 @@ async def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1313,17 +1315,17 @@ async def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _failover_initial( # pylint: disable=inconsistent-return-statements + async def _failover_initial( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1335,7 +1337,7 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1345,10 +1347,10 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1356,11 +1358,19 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1388,7 +1398,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._failover_initial( # type: ignore + raw_result = await self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1397,6 +1407,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1421,9 +1432,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async - async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def revoke_user_delegation_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1437,7 +1446,7 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1459,7 +1468,6 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_usages_operations.py index 3c033e6eb509..4685ab84451a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/aio/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usages_operations import build_list_by_location_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +72,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_mode api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-11-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -109,7 +105,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/__init__.py index 42c6403995da..4467ef55006a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/__init__.py @@ -5,106 +5,117 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccountSasParameters -from ._models_py3 import AzureEntityResource -from ._models_py3 import BlobContainer -from ._models_py3 import BlobServiceProperties -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CorsRule -from ._models_py3 import CorsRules -from ._models_py3 import CustomDomain -from ._models_py3 import DateAfterCreation -from ._models_py3 import DateAfterModification -from ._models_py3 import DeleteRetentionPolicy -from ._models_py3 import Dimension -from ._models_py3 import Encryption -from ._models_py3 import EncryptionService -from ._models_py3 import EncryptionServices -from ._models_py3 import Endpoints -from ._models_py3 import GeoReplicationStats -from ._models_py3 import IPRule -from ._models_py3 import Identity -from ._models_py3 import ImmutabilityPolicy -from ._models_py3 import ImmutabilityPolicyProperties -from ._models_py3 import KeyVaultProperties -from ._models_py3 import LeaseContainerRequest -from ._models_py3 import LeaseContainerResponse -from ._models_py3 import LegalHold -from ._models_py3 import LegalHoldProperties -from ._models_py3 import ListAccountSasResponse -from ._models_py3 import ListContainerItem -from ._models_py3 import ListContainerItems -from ._models_py3 import ListServiceSasResponse -from ._models_py3 import ManagementPolicy -from ._models_py3 import ManagementPolicyAction -from ._models_py3 import ManagementPolicyBaseBlob -from ._models_py3 import ManagementPolicyDefinition -from ._models_py3 import ManagementPolicyFilter -from ._models_py3 import ManagementPolicyRule -from ._models_py3 import ManagementPolicySchema -from ._models_py3 import ManagementPolicySnapShot -from ._models_py3 import MetricSpecification -from ._models_py3 import NetworkRuleSet -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import Resource -from ._models_py3 import Restriction -from ._models_py3 import SKUCapability -from ._models_py3 import ServiceSasParameters -from ._models_py3 import ServiceSpecification -from ._models_py3 import Sku -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountKey -from ._models_py3 import StorageAccountListKeysResult -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import StorageSkuListResult -from ._models_py3 import TagProperty -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateHistoryProperty -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._storage_management_client_enums import AccessTier -from ._storage_management_client_enums import AccountStatus -from ._storage_management_client_enums import Bypass -from ._storage_management_client_enums import CorsRuleAllowedMethodsItem -from ._storage_management_client_enums import DefaultAction -from ._storage_management_client_enums import Enum10 -from ._storage_management_client_enums import GeoReplicationStatus -from ._storage_management_client_enums import HttpProtocol -from ._storage_management_client_enums import ImmutabilityPolicyState -from ._storage_management_client_enums import ImmutabilityPolicyUpdateType -from ._storage_management_client_enums import KeyPermission -from ._storage_management_client_enums import KeySource -from ._storage_management_client_enums import Kind -from ._storage_management_client_enums import LeaseContainerRequestAction -from ._storage_management_client_enums import LeaseDuration -from ._storage_management_client_enums import LeaseState -from ._storage_management_client_enums import LeaseStatus -from ._storage_management_client_enums import ManagementPolicyName -from ._storage_management_client_enums import Permissions -from ._storage_management_client_enums import ProvisioningState -from ._storage_management_client_enums import PublicAccess -from ._storage_management_client_enums import Reason -from ._storage_management_client_enums import ReasonCode -from ._storage_management_client_enums import RuleType -from ._storage_management_client_enums import Services -from ._storage_management_client_enums import SignedResource -from ._storage_management_client_enums import SignedResourceTypes -from ._storage_management_client_enums import SkuName -from ._storage_management_client_enums import SkuTier -from ._storage_management_client_enums import State -from ._storage_management_client_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccountSasParameters, + AzureEntityResource, + BlobContainer, + BlobServiceProperties, + CheckNameAvailabilityResult, + CorsRule, + CorsRules, + CustomDomain, + DateAfterCreation, + DateAfterModification, + DeleteRetentionPolicy, + Dimension, + Encryption, + EncryptionService, + EncryptionServices, + Endpoints, + GeoReplicationStats, + IPRule, + Identity, + ImmutabilityPolicy, + ImmutabilityPolicyProperties, + KeyVaultProperties, + LeaseContainerRequest, + LeaseContainerResponse, + LegalHold, + LegalHoldProperties, + ListAccountSasResponse, + ListContainerItem, + ListContainerItems, + ListServiceSasResponse, + ManagementPolicy, + ManagementPolicyAction, + ManagementPolicyBaseBlob, + ManagementPolicyDefinition, + ManagementPolicyFilter, + ManagementPolicyRule, + ManagementPolicySchema, + ManagementPolicySnapShot, + MetricSpecification, + NetworkRuleSet, + Operation, + OperationDisplay, + OperationListResult, + Resource, + Restriction, + SKUCapability, + ServiceSasParameters, + ServiceSpecification, + Sku, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountKey, + StorageAccountListKeysResult, + StorageAccountListResult, + StorageAccountRegenerateKeyParameters, + StorageAccountUpdateParameters, + StorageSkuListResult, + TagProperty, + TrackedResource, + UpdateHistoryProperty, + Usage, + UsageListResult, + UsageName, + VirtualNetworkRule, +) + +from ._storage_management_client_enums import ( # type: ignore + AccessTier, + AccountStatus, + Bypass, + CorsRuleAllowedMethodsItem, + DefaultAction, + Enum10, + GeoReplicationStatus, + HttpProtocol, + ImmutabilityPolicyState, + ImmutabilityPolicyUpdateType, + KeyPermission, + KeySource, + Kind, + LeaseContainerRequestAction, + LeaseDuration, + LeaseState, + LeaseStatus, + ManagementPolicyName, + Permissions, + ProvisioningState, + PublicAccess, + Reason, + ReasonCode, + RuleType, + Services, + SignedResource, + SignedResourceTypes, + SkuName, + SkuTier, + State, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -205,5 +216,5 @@ "State", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/_models_py3.py index 82eae1af04b6..aab6b43060e4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,7 +13,6 @@ from ... import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -191,7 +190,7 @@ def __init__(self, **kwargs: Any) -> None: self.etag = None -class BlobContainer(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class BlobContainer(AzureEntityResource): """Properties of the blob container, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -1088,7 +1087,7 @@ class LeaseContainerRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2018_11_01.models.LeaseContainerRequestAction :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -1127,7 +1126,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2018_11_01.models.LeaseContainerRequestAction :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -1273,7 +1272,7 @@ def __init__(self, **kwargs: Any) -> None: self.account_sas_token = None -class ListContainerItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class ListContainerItem(AzureEntityResource): """The blob container properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -2019,7 +2018,7 @@ def __init__(self, *, reason_code: Optional[Union[str, "_models.ReasonCode"]] = self.reason_code = reason_code -class ServiceSasParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ServiceSasParameters(_serialization.Model): """The parameters to list service SAS credentials of a specific resource. All required parameters must be populated in order to send to server. @@ -2364,7 +2363,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class StorageAccount(TrackedResource): # pylint: disable=too-many-instance-attributes +class StorageAccount(TrackedResource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. @@ -2583,7 +2582,7 @@ def __init__(self, *, name: str, **kwargs: Any) -> None: self.name = name -class StorageAccountCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountCreateParameters(_serialization.Model): """The parameters used when creating a storage account. All required parameters must be populated in order to send to server. diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/_storage_management_client_enums.py index a1076c70bcec..355726683af8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/_storage_management_client_enums.py @@ -133,6 +133,7 @@ class LeaseContainerRequestAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/__init__.py index f845fcd0d9cb..a1c1461e660e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/__init__.py @@ -5,17 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -27,5 +33,5 @@ "BlobServicesOperations", "BlobContainersOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_blob_containers_operations.py index 3de7fa1159e8..f33a041a9cce 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -573,7 +571,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2018_11_01.models.ListContainerItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -595,7 +593,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -609,7 +606,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListContainerItems", pipeline_response) + deserialized = self._deserialize("ListContainerItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -722,7 +719,7 @@ def create( :rtype: ~azure.mgmt.storage.v2018_11_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -757,7 +754,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -771,11 +767,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -885,7 +877,7 @@ def update( :rtype: ~azure.mgmt.storage.v2018_11_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -920,7 +912,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -934,7 +925,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -963,7 +954,7 @@ def get( :rtype: ~azure.mgmt.storage.v2018_11_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -986,7 +977,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1000,7 +990,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1029,7 +1019,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1052,7 +1042,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1175,7 +1164,7 @@ def set_legal_hold( :rtype: ~azure.mgmt.storage.v2018_11_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1210,7 +1199,6 @@ def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1224,7 +1212,7 @@ def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1334,7 +1322,7 @@ def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2018_11_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1369,7 +1357,6 @@ def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1383,7 +1370,7 @@ def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1522,7 +1509,7 @@ def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_11_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1562,7 +1549,6 @@ def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1579,7 +1565,7 @@ def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1622,7 +1608,7 @@ def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_11_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1647,7 +1633,6 @@ def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1664,7 +1649,7 @@ def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1709,7 +1694,7 @@ def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_11_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1734,7 +1719,6 @@ def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1751,7 +1735,7 @@ def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1785,7 +1769,7 @@ def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_11_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1809,7 +1793,6 @@ def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1826,7 +1809,7 @@ def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1956,7 +1939,7 @@ def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2018_11_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1995,7 +1978,6 @@ def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2012,7 +1994,7 @@ def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2122,7 +2104,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2018_11_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2160,7 +2142,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2174,7 +2155,7 @@ def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_blob_services_operations.py index c852b93ed4e2..9835d18d5874 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -239,7 +236,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2018_11_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -274,7 +271,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -288,7 +284,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -316,7 +312,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2018_11_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -339,7 +335,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -353,7 +348,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_management_policies_operations.py index 9e3f037e3537..8c3347da2859 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -196,7 +193,7 @@ def get( :rtype: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,7 +216,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -233,7 +229,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +333,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2018_11_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +368,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -386,7 +381,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -418,7 +413,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -441,7 +436,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_operations.py index 2411b127983d..545c727f9eca 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-11-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -126,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_skus_operations.py index c75566ad2528..ea1b67675c21 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Sku"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-11-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_storage_accounts_operations.py index cfb196d19cff..fdc5ec5783ef 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -539,7 +539,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2018_11_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -571,7 +571,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -585,7 +584,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -598,8 +597,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -612,7 +611,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -633,10 +632,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -644,12 +643,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -772,10 +773,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -814,7 +816,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -836,7 +838,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -880,7 +881,7 @@ def get_properties( :rtype: ~azure.mgmt.storage.v2018_11_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -903,7 +904,6 @@ def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -917,7 +917,7 @@ def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1028,7 +1028,7 @@ def update( :rtype: ~azure.mgmt.storage.v2018_11_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1062,7 +1062,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1076,7 +1075,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1098,7 +1097,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-11-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1115,7 +1114,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1131,7 +1129,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1178,7 +1175,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-11-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1196,7 +1193,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1212,7 +1208,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1258,7 +1253,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2018_11_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1280,7 +1275,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1294,7 +1288,7 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1387,7 +1381,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2018_11_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1421,7 +1415,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1435,7 +1428,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1526,7 +1519,7 @@ def list_account_sas( :rtype: ~azure.mgmt.storage.v2018_11_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1560,7 +1553,6 @@ def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1574,7 +1566,7 @@ def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1663,7 +1655,7 @@ def list_service_sas( :rtype: ~azure.mgmt.storage.v2018_11_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1697,7 +1689,6 @@ def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1711,17 +1702,15 @@ def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _failover_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _failover_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1733,7 +1722,7 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1743,10 +1732,10 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1754,11 +1743,19 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1786,7 +1783,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._failover_initial( # type: ignore + raw_result = self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1795,6 +1792,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1835,7 +1833,7 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1857,7 +1855,6 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_usages_operations.py index 1aa7af3489cb..632880ca794b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -105,7 +102,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.Us api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-11-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -139,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/__init__.py index a860a5c185c9..60980065e1ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_configuration.py index 2d275656dfc0..83c2a903722c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_metadata.json index c47a92dae63d..d20a34625dcd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_storage_management_client.py index 4af127947d76..934c34d5c378 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -30,11 +31,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -150,7 +150,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_version.py index 5a163c0afedc..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" \ No newline at end of file +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/__init__.py index a5c3d2414cfd..ee2b940bd4fc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/_configuration.py index 2977f0428576..901c5cab0ec6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/_storage_management_client.py index 26736d3aec15..1a5f04d627e4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -30,11 +31,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -154,7 +154,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/__init__.py index 7a2c350acc25..226bb54cc4f5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/__init__.py @@ -5,19 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -31,5 +37,5 @@ "FileServicesOperations", "FileSharesOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_blob_containers_operations.py index 3348249ed922..fd4c0bfbbd2e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_containers_operations import ( build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, @@ -49,7 +47,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -113,7 +111,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-04-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -135,7 +133,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -151,7 +148,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -286,7 +282,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2019_04_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -321,7 +317,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -335,11 +330,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -449,7 +440,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2019_04_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -484,7 +475,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -498,7 +488,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -527,7 +517,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2019_04_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -550,7 +540,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -564,7 +553,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -572,9 +561,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -593,7 +580,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -616,7 +603,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -739,7 +725,7 @@ async def set_legal_hold( :rtype: ~azure.mgmt.storage.v2019_04_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -774,7 +760,6 @@ async def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -788,7 +773,7 @@ async def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -898,7 +883,7 @@ async def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2019_04_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -933,7 +918,6 @@ async def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -947,7 +931,7 @@ async def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1086,7 +1070,7 @@ async def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2019_04_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1126,7 +1110,6 @@ async def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1143,7 +1126,7 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1186,7 +1169,7 @@ async def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2019_04_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1211,7 +1194,6 @@ async def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1228,7 +1210,7 @@ async def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1273,7 +1255,7 @@ async def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2019_04_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1298,7 +1280,6 @@ async def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1315,7 +1296,7 @@ async def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1349,7 +1330,7 @@ async def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2019_04_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1373,7 +1354,6 @@ async def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1390,7 +1370,7 @@ async def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1520,7 +1500,7 @@ async def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2019_04_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1559,7 +1539,6 @@ async def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1576,7 +1555,7 @@ async def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1686,7 +1665,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2019_04_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1724,7 +1703,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1738,7 +1716,7 @@ async def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_blob_services_operations.py index 53725ce113f4..f222e1a76d18 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_services_operations import ( build_get_service_properties_request, build_list_request, @@ -39,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +86,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-04-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -253,7 +248,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2019_04_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -288,7 +283,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -302,7 +296,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -330,7 +324,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2019_04_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,7 +347,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -367,7 +360,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_file_services_operations.py index ca5cd13b1b1b..ea9f4b6f9461 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -219,7 +215,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,7 +250,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -268,7 +263,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -296,7 +291,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -319,7 +314,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -333,7 +327,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_file_shares_operations.py index fe3eceb971d9..8d88f41a8bcf 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_file_shares_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_shares_operations import ( build_create_request, build_delete_request, @@ -41,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -104,7 +101,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-04-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -126,7 +123,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -142,7 +138,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -277,7 +272,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -312,7 +307,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -326,11 +320,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -440,7 +430,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -475,7 +465,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -489,7 +478,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -518,7 +507,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -541,7 +530,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -555,7 +543,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -563,9 +551,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, share_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, share_name: str, **kwargs: Any) -> None: """Deletes specified share under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -584,7 +570,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -607,7 +593,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_management_policies_operations.py index 840d15da6708..eae106b4fcfa 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._management_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +119,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -227,7 +223,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -262,7 +258,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -276,7 +271,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -284,7 +279,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -308,7 +303,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +326,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_operations.py index a1d7a4986eb6..11973862324a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-04-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_skus_operations.py index ac61431cb4af..659f8531761f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Sku"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-04-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_storage_accounts_operations.py index 281947b2a6b3..e393b4106b8d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_check_name_availability_request, build_create_request, @@ -51,7 +64,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -134,7 +147,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2019_04_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -166,7 +179,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -180,7 +192,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -193,8 +205,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +219,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -228,10 +240,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -239,12 +251,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -370,10 +384,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -396,9 +411,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -412,7 +425,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -434,7 +447,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -478,7 +490,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2019_04_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -501,7 +513,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -515,7 +526,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -626,7 +637,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2019_04_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -660,7 +671,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -674,7 +684,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -697,7 +707,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-04-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -714,7 +724,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -730,7 +739,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -780,7 +788,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-04-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -798,7 +806,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -814,7 +821,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -864,7 +870,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2019_04_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -887,7 +893,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -901,7 +906,7 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -995,7 +1000,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2019_04_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1029,7 +1034,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1043,7 +1047,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1134,7 +1138,7 @@ async def list_account_sas( :rtype: ~azure.mgmt.storage.v2019_04_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1168,7 +1172,6 @@ async def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1182,7 +1185,7 @@ async def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1271,7 +1274,7 @@ async def list_service_sas( :rtype: ~azure.mgmt.storage.v2019_04_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1305,7 +1308,6 @@ async def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1319,17 +1321,17 @@ async def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _failover_initial( # pylint: disable=inconsistent-return-statements + async def _failover_initial( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1341,7 +1343,7 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1351,10 +1353,10 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1362,11 +1364,19 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1394,7 +1404,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._failover_initial( # type: ignore + raw_result = await self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1403,6 +1413,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1427,9 +1438,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async - async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def revoke_user_delegation_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1443,7 +1452,7 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1465,7 +1474,6 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_usages_operations.py index 8adaeeafa210..e707dc23a91e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/aio/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usages_operations import build_list_by_location_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +72,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_mode api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-04-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -109,7 +105,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/__init__.py index 168dcf6868dd..45389b878421 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/__init__.py @@ -5,119 +5,130 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccountSasParameters -from ._models_py3 import ActiveDirectoryProperties -from ._models_py3 import AzureEntityResource -from ._models_py3 import AzureFilesIdentityBasedAuthentication -from ._models_py3 import BlobContainer -from ._models_py3 import BlobServiceItems -from ._models_py3 import BlobServiceProperties -from ._models_py3 import ChangeFeed -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CloudErrorBody -from ._models_py3 import CorsRule -from ._models_py3 import CorsRules -from ._models_py3 import CustomDomain -from ._models_py3 import DateAfterCreation -from ._models_py3 import DateAfterModification -from ._models_py3 import DeleteRetentionPolicy -from ._models_py3 import Dimension -from ._models_py3 import Encryption -from ._models_py3 import EncryptionService -from ._models_py3 import EncryptionServices -from ._models_py3 import Endpoints -from ._models_py3 import FileServiceItems -from ._models_py3 import FileServiceProperties -from ._models_py3 import FileShare -from ._models_py3 import FileShareItem -from ._models_py3 import FileShareItems -from ._models_py3 import GeoReplicationStats -from ._models_py3 import IPRule -from ._models_py3 import Identity -from ._models_py3 import ImmutabilityPolicy -from ._models_py3 import ImmutabilityPolicyProperties -from ._models_py3 import KeyVaultProperties -from ._models_py3 import LeaseContainerRequest -from ._models_py3 import LeaseContainerResponse -from ._models_py3 import LegalHold -from ._models_py3 import LegalHoldProperties -from ._models_py3 import ListAccountSasResponse -from ._models_py3 import ListContainerItem -from ._models_py3 import ListContainerItems -from ._models_py3 import ListServiceSasResponse -from ._models_py3 import ManagementPolicy -from ._models_py3 import ManagementPolicyAction -from ._models_py3 import ManagementPolicyBaseBlob -from ._models_py3 import ManagementPolicyDefinition -from ._models_py3 import ManagementPolicyFilter -from ._models_py3 import ManagementPolicyRule -from ._models_py3 import ManagementPolicySchema -from ._models_py3 import ManagementPolicySnapShot -from ._models_py3 import MetricSpecification -from ._models_py3 import NetworkRuleSet -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import Resource -from ._models_py3 import Restriction -from ._models_py3 import SKUCapability -from ._models_py3 import ServiceSasParameters -from ._models_py3 import ServiceSpecification -from ._models_py3 import Sku -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountKey -from ._models_py3 import StorageAccountListKeysResult -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import StorageSkuListResult -from ._models_py3 import TagProperty -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateHistoryProperty -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._storage_management_client_enums import AccessTier -from ._storage_management_client_enums import AccountStatus -from ._storage_management_client_enums import Bypass -from ._storage_management_client_enums import CorsRuleAllowedMethodsItem -from ._storage_management_client_enums import DefaultAction -from ._storage_management_client_enums import DirectoryServiceOptions -from ._storage_management_client_enums import Enum16 -from ._storage_management_client_enums import GeoReplicationStatus -from ._storage_management_client_enums import HttpProtocol -from ._storage_management_client_enums import ImmutabilityPolicyState -from ._storage_management_client_enums import ImmutabilityPolicyUpdateType -from ._storage_management_client_enums import KeyPermission -from ._storage_management_client_enums import KeySource -from ._storage_management_client_enums import Kind -from ._storage_management_client_enums import LargeFileSharesState -from ._storage_management_client_enums import LeaseContainerRequestAction -from ._storage_management_client_enums import LeaseDuration -from ._storage_management_client_enums import LeaseState -from ._storage_management_client_enums import LeaseStatus -from ._storage_management_client_enums import ManagementPolicyName -from ._storage_management_client_enums import MinimumTlsVersion -from ._storage_management_client_enums import Permissions -from ._storage_management_client_enums import ProvisioningState -from ._storage_management_client_enums import PublicAccess -from ._storage_management_client_enums import Reason -from ._storage_management_client_enums import ReasonCode -from ._storage_management_client_enums import RuleType -from ._storage_management_client_enums import Services -from ._storage_management_client_enums import SignedResource -from ._storage_management_client_enums import SignedResourceTypes -from ._storage_management_client_enums import SkuName -from ._storage_management_client_enums import SkuTier -from ._storage_management_client_enums import State -from ._storage_management_client_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccountSasParameters, + ActiveDirectoryProperties, + AzureEntityResource, + AzureFilesIdentityBasedAuthentication, + BlobContainer, + BlobServiceItems, + BlobServiceProperties, + ChangeFeed, + CheckNameAvailabilityResult, + CloudErrorBody, + CorsRule, + CorsRules, + CustomDomain, + DateAfterCreation, + DateAfterModification, + DeleteRetentionPolicy, + Dimension, + Encryption, + EncryptionService, + EncryptionServices, + Endpoints, + FileServiceItems, + FileServiceProperties, + FileShare, + FileShareItem, + FileShareItems, + GeoReplicationStats, + IPRule, + Identity, + ImmutabilityPolicy, + ImmutabilityPolicyProperties, + KeyVaultProperties, + LeaseContainerRequest, + LeaseContainerResponse, + LegalHold, + LegalHoldProperties, + ListAccountSasResponse, + ListContainerItem, + ListContainerItems, + ListServiceSasResponse, + ManagementPolicy, + ManagementPolicyAction, + ManagementPolicyBaseBlob, + ManagementPolicyDefinition, + ManagementPolicyFilter, + ManagementPolicyRule, + ManagementPolicySchema, + ManagementPolicySnapShot, + MetricSpecification, + NetworkRuleSet, + Operation, + OperationDisplay, + OperationListResult, + Resource, + Restriction, + SKUCapability, + ServiceSasParameters, + ServiceSpecification, + Sku, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountKey, + StorageAccountListKeysResult, + StorageAccountListResult, + StorageAccountRegenerateKeyParameters, + StorageAccountUpdateParameters, + StorageSkuListResult, + TagProperty, + TrackedResource, + UpdateHistoryProperty, + Usage, + UsageListResult, + UsageName, + VirtualNetworkRule, +) + +from ._storage_management_client_enums import ( # type: ignore + AccessTier, + AccountStatus, + Bypass, + CorsRuleAllowedMethodsItem, + DefaultAction, + DirectoryServiceOptions, + Enum16, + GeoReplicationStatus, + HttpProtocol, + ImmutabilityPolicyState, + ImmutabilityPolicyUpdateType, + KeyPermission, + KeySource, + Kind, + LargeFileSharesState, + LeaseContainerRequestAction, + LeaseDuration, + LeaseState, + LeaseStatus, + ManagementPolicyName, + MinimumTlsVersion, + Permissions, + ProvisioningState, + PublicAccess, + Reason, + ReasonCode, + RuleType, + Services, + SignedResource, + SignedResourceTypes, + SkuName, + SkuTier, + State, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -231,5 +242,5 @@ "State", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models_py3.py index eb7740eaf82c..e37f5b482883 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,7 +13,6 @@ from ... import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -309,7 +308,7 @@ def __init__( self.active_directory_properties = active_directory_properties -class BlobContainer(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class BlobContainer(AzureEntityResource): """Properties of the blob container, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -1529,7 +1528,7 @@ class LeaseContainerRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2019_04_01.models.LeaseContainerRequestAction :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -1568,7 +1567,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2019_04_01.models.LeaseContainerRequestAction :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -1714,7 +1713,7 @@ def __init__(self, **kwargs: Any) -> None: self.account_sas_token = None -class ListContainerItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class ListContainerItem(AzureEntityResource): """The blob container properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -2470,7 +2469,7 @@ def __init__(self, *, reason_code: Optional[Union[str, "_models.ReasonCode"]] = self.reason_code = reason_code -class ServiceSasParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ServiceSasParameters(_serialization.Model): """The parameters to list service SAS credentials of a specific resource. All required parameters must be populated in order to send to server. @@ -2815,7 +2814,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class StorageAccount(TrackedResource): # pylint: disable=too-many-instance-attributes +class StorageAccount(TrackedResource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. @@ -3083,7 +3082,7 @@ def __init__(self, *, name: str, **kwargs: Any) -> None: self.name = name -class StorageAccountCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountCreateParameters(_serialization.Model): """The parameters used when creating a storage account. All required parameters must be populated in order to send to server. @@ -3383,7 +3382,7 @@ def __init__(self, *, key_name: str, **kwargs: Any) -> None: self.key_name = key_name -class StorageAccountUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountUpdateParameters(_serialization.Model): """The parameters that can be provided when updating the storage account properties. :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_storage_management_client_enums.py index d2f96238f31a..987f92f35b12 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_storage_management_client_enums.py @@ -148,6 +148,7 @@ class LeaseContainerRequestAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/__init__.py index 7a2c350acc25..226bb54cc4f5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/__init__.py @@ -5,19 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -31,5 +37,5 @@ "FileServicesOperations", "FileSharesOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_blob_containers_operations.py index 22f6942d6b1b..269afead38ce 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -612,7 +610,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-04-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -634,7 +632,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -650,7 +647,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -785,7 +781,7 @@ def create( :rtype: ~azure.mgmt.storage.v2019_04_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -820,7 +816,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -834,11 +829,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -948,7 +939,7 @@ def update( :rtype: ~azure.mgmt.storage.v2019_04_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -983,7 +974,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -997,7 +987,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1026,7 +1016,7 @@ def get( :rtype: ~azure.mgmt.storage.v2019_04_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1049,7 +1039,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1063,7 +1052,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1092,7 +1081,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1115,7 +1104,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1238,7 +1226,7 @@ def set_legal_hold( :rtype: ~azure.mgmt.storage.v2019_04_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1273,7 +1261,6 @@ def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1287,7 +1274,7 @@ def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1397,7 +1384,7 @@ def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2019_04_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1432,7 +1419,6 @@ def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1446,7 +1432,7 @@ def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1585,7 +1571,7 @@ def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2019_04_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1625,7 +1611,6 @@ def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1642,7 +1627,7 @@ def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1685,7 +1670,7 @@ def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2019_04_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1710,7 +1695,6 @@ def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1727,7 +1711,7 @@ def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1772,7 +1756,7 @@ def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2019_04_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1797,7 +1781,6 @@ def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1814,7 +1797,7 @@ def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1848,7 +1831,7 @@ def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2019_04_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1872,7 +1855,6 @@ def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1889,7 +1871,7 @@ def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2019,7 +2001,7 @@ def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2019_04_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2058,7 +2040,6 @@ def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2075,7 +2056,7 @@ def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2185,7 +2166,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2019_04_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2223,7 +2204,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2237,7 +2217,7 @@ def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_blob_services_operations.py index 9f47cc8752c6..19e89c87023a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -197,7 +194,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-04-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -216,7 +213,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -232,7 +228,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -361,7 +356,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2019_04_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -396,7 +391,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -410,7 +404,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -438,7 +432,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2019_04_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -461,7 +455,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -475,7 +468,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_services_operations.py index 4e5ea192885a..3ea7dba8cff8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +204,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -221,7 +217,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -328,7 +324,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -363,7 +359,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -377,7 +372,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -405,7 +400,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -428,7 +423,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -442,7 +436,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_shares_operations.py index cbd78c8dd045..223ca0aa4de8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_shares_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -287,7 +284,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-04-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -309,7 +306,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -325,7 +321,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -460,7 +455,7 @@ def create( :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -495,7 +490,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -509,11 +503,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -623,7 +613,7 @@ def update( :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -658,7 +648,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -672,7 +661,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -699,7 +688,7 @@ def get(self, resource_group_name: str, account_name: str, share_name: str, **kw :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -722,7 +711,6 @@ def get(self, resource_group_name: str, account_name: str, share_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -736,7 +724,7 @@ def get(self, resource_group_name: str, account_name: str, share_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -765,7 +753,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -788,7 +776,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_management_policies_operations.py index cb4dc603c8ba..042a9359a927 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -196,7 +193,7 @@ def get( :rtype: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,7 +216,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -233,7 +229,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +333,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2019_04_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +368,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -386,7 +381,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -418,7 +413,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -441,7 +436,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_operations.py index b6f8758d542b..c0a9cc40dfb4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-04-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -126,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_skus_operations.py index af99e9bb342d..aaf52b6b54bb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Sku"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-04-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_storage_accounts_operations.py index acfb574ee6d9..6003aafddfdb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -546,7 +546,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2019_04_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -578,7 +578,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -592,7 +591,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -605,8 +604,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -619,7 +618,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -640,10 +639,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -651,12 +650,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -779,10 +780,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -821,7 +823,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -843,7 +845,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -887,7 +888,7 @@ def get_properties( :rtype: ~azure.mgmt.storage.v2019_04_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -910,7 +911,6 @@ def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -924,7 +924,7 @@ def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1035,7 +1035,7 @@ def update( :rtype: ~azure.mgmt.storage.v2019_04_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1069,7 +1069,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1083,7 +1082,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1105,7 +1104,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-04-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1122,7 +1121,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1138,7 +1136,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1185,7 +1182,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-04-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1203,7 +1200,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1219,7 +1215,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1269,7 +1264,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2019_04_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1292,7 +1287,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1306,7 +1300,7 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1400,7 +1394,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2019_04_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1434,7 +1428,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1448,7 +1441,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1539,7 +1532,7 @@ def list_account_sas( :rtype: ~azure.mgmt.storage.v2019_04_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1573,7 +1566,6 @@ def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1587,7 +1579,7 @@ def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1676,7 +1668,7 @@ def list_service_sas( :rtype: ~azure.mgmt.storage.v2019_04_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1710,7 +1702,6 @@ def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1724,17 +1715,15 @@ def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _failover_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _failover_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1746,7 +1735,7 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1756,10 +1745,10 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1767,11 +1756,19 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1799,7 +1796,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._failover_initial( # type: ignore + raw_result = self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1808,6 +1805,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1848,7 +1846,7 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1870,7 +1868,6 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_usages_operations.py index 463a1c56fb07..0da0fa861600 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -105,7 +102,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.Us api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-04-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -139,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/__init__.py index a860a5c185c9..60980065e1ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_configuration.py index 930089579920..b0411488a599 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_metadata.json index d0aad11e8f3c..222e258ecdbb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_storage_management_client.py index 6e61963301dc..a4e5fc844856 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -39,11 +40,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -205,7 +205,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_version.py index 5a163c0afedc..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" \ No newline at end of file +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/__init__.py index a5c3d2414cfd..ee2b940bd4fc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/_configuration.py index 1df02180dece..4563ef1ea72b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/_storage_management_client.py index c9cb501a41f7..9cdb870e8540 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -39,11 +40,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -209,7 +209,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/__init__.py index d796f35045aa..b529831709ad 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/__init__.py @@ -5,28 +5,34 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -49,5 +55,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_containers_operations.py index fdeb87a361d3..c34a58396c05 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_containers_operations import ( build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, @@ -49,7 +47,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -114,7 +112,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -136,7 +134,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -152,7 +149,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -287,7 +283,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2019_06_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -322,7 +318,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -336,11 +331,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -450,7 +441,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2019_06_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -485,7 +476,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -499,7 +489,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -528,7 +518,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2019_06_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -551,7 +541,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -565,7 +554,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -573,9 +562,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -594,7 +581,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -617,7 +604,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -740,7 +726,7 @@ async def set_legal_hold( :rtype: ~azure.mgmt.storage.v2019_06_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -775,7 +761,6 @@ async def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -789,7 +774,7 @@ async def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -899,7 +884,7 @@ async def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2019_06_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -934,7 +919,6 @@ async def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -948,7 +932,7 @@ async def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1087,7 +1071,7 @@ async def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1127,7 +1111,6 @@ async def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1144,7 +1127,7 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1187,7 +1170,7 @@ async def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1212,7 +1195,6 @@ async def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1229,7 +1211,7 @@ async def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1274,7 +1256,7 @@ async def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1299,7 +1281,6 @@ async def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1316,7 +1297,7 @@ async def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1350,7 +1331,7 @@ async def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1374,7 +1355,6 @@ async def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1391,7 +1371,7 @@ async def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1521,7 +1501,7 @@ async def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1560,7 +1540,6 @@ async def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1577,7 +1556,7 @@ async def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1687,7 +1666,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2019_06_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1725,7 +1704,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1739,7 +1717,7 @@ async def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_inventory_policies_operations.py index a907a7ef28cd..a0aa906918fa 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_inventory_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,7 +110,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -128,7 +124,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -232,7 +228,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -267,7 +263,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -282,7 +277,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -290,7 +285,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -314,7 +309,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -337,7 +332,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -379,7 +373,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -398,7 +392,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -414,7 +407,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_services_operations.py index f99fe53d90cd..6e454850c2de 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_services_operations import ( build_get_service_properties_request, build_list_request, @@ -39,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +86,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -253,7 +248,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2019_06_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -288,7 +283,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -302,7 +296,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -330,7 +324,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2019_06_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,7 +347,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -367,7 +360,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_encryption_scopes_operations.py index 9125fbbed8ba..15d6b9c6383f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._encryption_scopes_operations import ( build_get_request, build_list_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -173,7 +170,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2019_06_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +205,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -223,11 +219,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +329,7 @@ async def patch( :rtype: ~azure.mgmt.storage.v2019_06_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +364,6 @@ async def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -387,7 +378,7 @@ async def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -416,7 +407,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2019_06_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -439,7 +430,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -454,7 +444,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -485,7 +475,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +494,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -520,7 +509,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_file_services_operations.py index b1eea16c4f84..835999570b5f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2019_06_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -219,7 +215,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2019_06_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,7 +250,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -268,7 +263,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -296,7 +291,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2019_06_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -319,7 +314,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -333,7 +327,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_file_shares_operations.py index 4c7b6c438832..6748c636e451 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_file_shares_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_shares_operations import ( build_create_request, build_delete_request, @@ -42,7 +39,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -106,7 +103,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -128,7 +125,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -144,7 +140,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -279,7 +274,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2019_06_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -314,7 +309,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -328,11 +322,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -442,7 +432,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2019_06_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -477,7 +467,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -491,7 +480,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -528,7 +517,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2019_06_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -552,7 +541,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -566,7 +554,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -574,9 +562,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, share_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, share_name: str, **kwargs: Any) -> None: """Deletes specified share under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -595,7 +581,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -618,7 +604,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -636,7 +621,7 @@ async def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -671,7 +656,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -706,7 +691,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -734,7 +719,7 @@ async def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -769,7 +754,6 @@ async def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_management_policies_operations.py index 7c0e0e7c3858..28fd08cef210 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._management_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +119,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -227,7 +223,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -262,7 +258,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -276,7 +271,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -284,7 +279,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -308,7 +303,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +326,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_object_replication_policies_operations.py index fcd43b94baa9..b96bc1132574 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._object_replication_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -175,7 +170,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -198,7 +193,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -213,7 +207,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -317,7 +311,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -352,7 +346,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -367,7 +360,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -375,7 +368,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, object_replication_policy_id: str, **kwargs: Any ) -> None: """Deletes the object replication policy associated with the specified storage account. @@ -394,7 +387,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -417,7 +410,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_operations.py index 273b31c2bb01..8eb80d771781 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_private_endpoint_connections_operations.py index 67d772564818..256f5334cadf 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connections_operations import ( build_delete_request, build_get_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -174,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2019_06_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -197,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -212,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -313,7 +307,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2019_06_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +342,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -363,7 +356,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -371,7 +364,7 @@ async def put( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: """Deletes the specified private endpoint connection associated with the storage account. @@ -390,7 +383,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -413,7 +406,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_private_link_resources_operations.py index ea7dae57af8b..594d676eba82 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_by_storage_account_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ async def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2019_06_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,7 +92,6 @@ async def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +105,7 @@ async def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_queue_operations.py index 7c6f1dbcb3f0..4d36651587df 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_operations import ( build_create_request, build_delete_request, @@ -41,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -166,7 +163,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -322,7 +318,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -357,7 +353,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -371,7 +366,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -400,7 +395,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +418,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -437,7 +431,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -445,9 +439,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any) -> None: """Deletes the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -466,7 +458,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -489,7 +481,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -541,7 +532,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -562,7 +553,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -578,7 +568,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_queue_services_operations.py index 09ff686365bd..d5af3a0e1640 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2019_06_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -219,7 +215,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2019_06_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,7 +250,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -268,7 +263,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -296,7 +291,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2019_06_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -319,7 +314,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -333,7 +327,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_skus_operations.py index 4da075450ce4..fc51a0e33dee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -90,7 +87,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -106,7 +102,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_storage_accounts_operations.py index b0834c0b1e89..1356e122e419 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_check_name_availability_request, build_create_request, @@ -52,7 +65,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -135,7 +148,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2019_06_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -167,7 +180,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -181,7 +193,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -194,8 +206,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +220,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -229,10 +241,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -240,12 +252,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -371,10 +385,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -397,9 +412,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -413,7 +426,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -435,7 +448,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -480,7 +492,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -503,7 +515,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -517,7 +528,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -628,7 +639,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -662,7 +673,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -676,7 +686,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -699,7 +709,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -716,7 +726,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -732,7 +741,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -782,7 +790,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -800,7 +808,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -816,7 +823,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -866,7 +872,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -889,7 +895,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -903,7 +908,7 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -997,7 +1002,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1031,7 +1036,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1045,7 +1049,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1136,7 +1140,7 @@ async def list_account_sas( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1170,7 +1174,6 @@ async def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1184,7 +1187,7 @@ async def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1273,7 +1276,7 @@ async def list_service_sas( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1307,7 +1310,6 @@ async def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1321,17 +1323,17 @@ async def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _failover_initial( # pylint: disable=inconsistent-return-statements + async def _failover_initial( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1343,7 +1345,7 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1353,10 +1355,10 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1364,11 +1366,19 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1396,7 +1406,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._failover_initial( # type: ignore + raw_result = await self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1405,6 +1415,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1434,8 +1445,8 @@ async def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1448,7 +1459,7 @@ async def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1469,10 +1480,10 @@ async def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1480,14 +1491,14 @@ async def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1603,10 +1614,11 @@ async def begin_restore_blob_ranges( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1631,9 +1643,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def revoke_user_delegation_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1647,7 +1657,7 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1669,7 +1679,6 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_table_operations.py index 77d60a0f77f0..387a016e1136 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_operations import ( build_create_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2019_06_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +119,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -151,7 +147,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2019_06_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -174,7 +170,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -188,7 +183,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -214,7 +209,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str :rtype: ~azure.mgmt.storage.v2019_06_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -237,7 +232,6 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -251,7 +245,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -259,9 +253,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any) -> None: """Deletes the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -279,7 +271,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -302,7 +294,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -340,7 +331,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -359,7 +350,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -375,7 +365,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_table_services_operations.py index c963d9020144..a23500630384 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2019_06_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -219,7 +215,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2019_06_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,7 +250,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -268,7 +263,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -296,7 +291,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2019_06_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -319,7 +314,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -333,7 +327,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_usages_operations.py index b6ec73020f96..9f85d2933d86 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/aio/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usages_operations import build_list_by_location_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +72,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_mode api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -109,7 +105,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/__init__.py index dbc63ffaee2b..360aa83fd23b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/__init__.py @@ -5,178 +5,189 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccountSasParameters -from ._models_py3 import ActiveDirectoryProperties -from ._models_py3 import AzureEntityResource -from ._models_py3 import AzureFilesIdentityBasedAuthentication -from ._models_py3 import BlobContainer -from ._models_py3 import BlobInventoryPolicy -from ._models_py3 import BlobInventoryPolicyDefinition -from ._models_py3 import BlobInventoryPolicyFilter -from ._models_py3 import BlobInventoryPolicyRule -from ._models_py3 import BlobInventoryPolicySchema -from ._models_py3 import BlobRestoreParameters -from ._models_py3 import BlobRestoreRange -from ._models_py3 import BlobRestoreStatus -from ._models_py3 import BlobServiceItems -from ._models_py3 import BlobServiceProperties -from ._models_py3 import ChangeFeed -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CloudErrorBody -from ._models_py3 import CorsRule -from ._models_py3 import CorsRules -from ._models_py3 import CustomDomain -from ._models_py3 import DateAfterCreation -from ._models_py3 import DateAfterModification -from ._models_py3 import DeleteRetentionPolicy -from ._models_py3 import DeletedShare -from ._models_py3 import Dimension -from ._models_py3 import Encryption -from ._models_py3 import EncryptionScope -from ._models_py3 import EncryptionScopeKeyVaultProperties -from ._models_py3 import EncryptionScopeListResult -from ._models_py3 import EncryptionService -from ._models_py3 import EncryptionServices -from ._models_py3 import Endpoints -from ._models_py3 import ErrorResponse -from ._models_py3 import ErrorResponseBody -from ._models_py3 import FileServiceItems -from ._models_py3 import FileServiceProperties -from ._models_py3 import FileShare -from ._models_py3 import FileShareItem -from ._models_py3 import FileShareItems -from ._models_py3 import GeoReplicationStats -from ._models_py3 import IPRule -from ._models_py3 import Identity -from ._models_py3 import ImmutabilityPolicy -from ._models_py3 import ImmutabilityPolicyProperties -from ._models_py3 import KeyVaultProperties -from ._models_py3 import LastAccessTimeTrackingPolicy -from ._models_py3 import LeaseContainerRequest -from ._models_py3 import LeaseContainerResponse -from ._models_py3 import LegalHold -from ._models_py3 import LegalHoldProperties -from ._models_py3 import ListAccountSasResponse -from ._models_py3 import ListBlobInventoryPolicy -from ._models_py3 import ListContainerItem -from ._models_py3 import ListContainerItems -from ._models_py3 import ListQueue -from ._models_py3 import ListQueueResource -from ._models_py3 import ListQueueServices -from ._models_py3 import ListServiceSasResponse -from ._models_py3 import ListTableResource -from ._models_py3 import ListTableServices -from ._models_py3 import ManagementPolicy -from ._models_py3 import ManagementPolicyAction -from ._models_py3 import ManagementPolicyBaseBlob -from ._models_py3 import ManagementPolicyDefinition -from ._models_py3 import ManagementPolicyFilter -from ._models_py3 import ManagementPolicyRule -from ._models_py3 import ManagementPolicySchema -from ._models_py3 import ManagementPolicySnapShot -from ._models_py3 import ManagementPolicyVersion -from ._models_py3 import MetricSpecification -from ._models_py3 import NetworkRuleSet -from ._models_py3 import ObjectReplicationPolicies -from ._models_py3 import ObjectReplicationPolicy -from ._models_py3 import ObjectReplicationPolicyFilter -from ._models_py3 import ObjectReplicationPolicyRule -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import PrivateEndpoint -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionListResult -from ._models_py3 import PrivateLinkResource -from ._models_py3 import PrivateLinkResourceListResult -from ._models_py3 import PrivateLinkServiceConnectionState -from ._models_py3 import QueueServiceProperties -from ._models_py3 import Resource -from ._models_py3 import RestorePolicyProperties -from ._models_py3 import Restriction -from ._models_py3 import RoutingPreference -from ._models_py3 import SKUCapability -from ._models_py3 import ServiceSasParameters -from ._models_py3 import ServiceSpecification -from ._models_py3 import Sku -from ._models_py3 import SkuInformation -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountInternetEndpoints -from ._models_py3 import StorageAccountKey -from ._models_py3 import StorageAccountListKeysResult -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountMicrosoftEndpoints -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import StorageQueue -from ._models_py3 import StorageSkuListResult -from ._models_py3 import SystemData -from ._models_py3 import Table -from ._models_py3 import TableServiceProperties -from ._models_py3 import TagFilter -from ._models_py3 import TagProperty -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateHistoryProperty -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._storage_management_client_enums import AccessTier -from ._storage_management_client_enums import AccountStatus -from ._storage_management_client_enums import BlobInventoryPolicyName -from ._storage_management_client_enums import BlobRestoreProgressStatus -from ._storage_management_client_enums import Bypass -from ._storage_management_client_enums import CorsRuleAllowedMethodsItem -from ._storage_management_client_enums import CreatedByType -from ._storage_management_client_enums import DefaultAction -from ._storage_management_client_enums import DirectoryServiceOptions -from ._storage_management_client_enums import EnabledProtocols -from ._storage_management_client_enums import EncryptionScopeSource -from ._storage_management_client_enums import EncryptionScopeState -from ._storage_management_client_enums import Enum27 -from ._storage_management_client_enums import GeoReplicationStatus -from ._storage_management_client_enums import HttpProtocol -from ._storage_management_client_enums import ImmutabilityPolicyState -from ._storage_management_client_enums import ImmutabilityPolicyUpdateType -from ._storage_management_client_enums import InventoryRuleType -from ._storage_management_client_enums import KeyPermission -from ._storage_management_client_enums import KeySource -from ._storage_management_client_enums import KeyType -from ._storage_management_client_enums import Kind -from ._storage_management_client_enums import LargeFileSharesState -from ._storage_management_client_enums import LeaseContainerRequestAction -from ._storage_management_client_enums import LeaseDuration -from ._storage_management_client_enums import LeaseState -from ._storage_management_client_enums import LeaseStatus -from ._storage_management_client_enums import ListContainersInclude -from ._storage_management_client_enums import ManagementPolicyName -from ._storage_management_client_enums import MinimumTlsVersion -from ._storage_management_client_enums import Name -from ._storage_management_client_enums import Permissions -from ._storage_management_client_enums import PrivateEndpointConnectionProvisioningState -from ._storage_management_client_enums import PrivateEndpointServiceConnectionStatus -from ._storage_management_client_enums import ProvisioningState -from ._storage_management_client_enums import PublicAccess -from ._storage_management_client_enums import Reason -from ._storage_management_client_enums import ReasonCode -from ._storage_management_client_enums import RootSquashType -from ._storage_management_client_enums import RoutingChoice -from ._storage_management_client_enums import RuleType -from ._storage_management_client_enums import Services -from ._storage_management_client_enums import ShareAccessTier -from ._storage_management_client_enums import SignedResource -from ._storage_management_client_enums import SignedResourceTypes -from ._storage_management_client_enums import SkuName -from ._storage_management_client_enums import SkuTier -from ._storage_management_client_enums import State -from ._storage_management_client_enums import StorageAccountExpand -from ._storage_management_client_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccountSasParameters, + ActiveDirectoryProperties, + AzureEntityResource, + AzureFilesIdentityBasedAuthentication, + BlobContainer, + BlobInventoryPolicy, + BlobInventoryPolicyDefinition, + BlobInventoryPolicyFilter, + BlobInventoryPolicyRule, + BlobInventoryPolicySchema, + BlobRestoreParameters, + BlobRestoreRange, + BlobRestoreStatus, + BlobServiceItems, + BlobServiceProperties, + ChangeFeed, + CheckNameAvailabilityResult, + CloudErrorBody, + CorsRule, + CorsRules, + CustomDomain, + DateAfterCreation, + DateAfterModification, + DeleteRetentionPolicy, + DeletedShare, + Dimension, + Encryption, + EncryptionScope, + EncryptionScopeKeyVaultProperties, + EncryptionScopeListResult, + EncryptionService, + EncryptionServices, + Endpoints, + ErrorResponse, + ErrorResponseBody, + FileServiceItems, + FileServiceProperties, + FileShare, + FileShareItem, + FileShareItems, + GeoReplicationStats, + IPRule, + Identity, + ImmutabilityPolicy, + ImmutabilityPolicyProperties, + KeyVaultProperties, + LastAccessTimeTrackingPolicy, + LeaseContainerRequest, + LeaseContainerResponse, + LegalHold, + LegalHoldProperties, + ListAccountSasResponse, + ListBlobInventoryPolicy, + ListContainerItem, + ListContainerItems, + ListQueue, + ListQueueResource, + ListQueueServices, + ListServiceSasResponse, + ListTableResource, + ListTableServices, + ManagementPolicy, + ManagementPolicyAction, + ManagementPolicyBaseBlob, + ManagementPolicyDefinition, + ManagementPolicyFilter, + ManagementPolicyRule, + ManagementPolicySchema, + ManagementPolicySnapShot, + ManagementPolicyVersion, + MetricSpecification, + NetworkRuleSet, + ObjectReplicationPolicies, + ObjectReplicationPolicy, + ObjectReplicationPolicyFilter, + ObjectReplicationPolicyRule, + Operation, + OperationDisplay, + OperationListResult, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionListResult, + PrivateLinkResource, + PrivateLinkResourceListResult, + PrivateLinkServiceConnectionState, + QueueServiceProperties, + Resource, + RestorePolicyProperties, + Restriction, + RoutingPreference, + SKUCapability, + ServiceSasParameters, + ServiceSpecification, + Sku, + SkuInformation, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountInternetEndpoints, + StorageAccountKey, + StorageAccountListKeysResult, + StorageAccountListResult, + StorageAccountMicrosoftEndpoints, + StorageAccountRegenerateKeyParameters, + StorageAccountUpdateParameters, + StorageQueue, + StorageSkuListResult, + SystemData, + Table, + TableServiceProperties, + TagFilter, + TagProperty, + TrackedResource, + UpdateHistoryProperty, + Usage, + UsageListResult, + UsageName, + VirtualNetworkRule, +) + +from ._storage_management_client_enums import ( # type: ignore + AccessTier, + AccountStatus, + BlobInventoryPolicyName, + BlobRestoreProgressStatus, + Bypass, + CorsRuleAllowedMethodsItem, + CreatedByType, + DefaultAction, + DirectoryServiceOptions, + EnabledProtocols, + EncryptionScopeSource, + EncryptionScopeState, + Enum27, + GeoReplicationStatus, + HttpProtocol, + ImmutabilityPolicyState, + ImmutabilityPolicyUpdateType, + InventoryRuleType, + KeyPermission, + KeySource, + KeyType, + Kind, + LargeFileSharesState, + LeaseContainerRequestAction, + LeaseDuration, + LeaseState, + LeaseStatus, + ListContainersInclude, + ManagementPolicyName, + MinimumTlsVersion, + Name, + Permissions, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProvisioningState, + PublicAccess, + Reason, + ReasonCode, + RootSquashType, + RoutingChoice, + RuleType, + Services, + ShareAccessTier, + SignedResource, + SignedResourceTypes, + SkuName, + SkuTier, + State, + StorageAccountExpand, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -349,5 +360,5 @@ "StorageAccountExpand", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models_py3.py index d06c275402f9..7b0ceea0610c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,7 +13,6 @@ from ... import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -309,7 +308,7 @@ def __init__( self.active_directory_properties = active_directory_properties -class BlobContainer(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class BlobContainer(AzureEntityResource): """Properties of the blob container, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -819,7 +818,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class BlobServiceProperties(Resource): # pylint: disable=too-many-instance-attributes +class BlobServiceProperties(Resource): """The properties of a storage account’s Blob service. Variables are only populated by the server, and will be ignored when sending a request. @@ -1866,7 +1865,7 @@ def __init__( self.share_delete_retention_policy = share_delete_retention_policy -class FileShare(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShare(AzureEntityResource): """Properties of the file share, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -1994,7 +1993,7 @@ def __init__( self.share_usage_bytes = None -class FileShareItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShareItem(AzureEntityResource): """The file share properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -2526,7 +2525,7 @@ class LeaseContainerRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2019_06_01.models.LeaseContainerRequestAction :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -2565,7 +2564,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2019_06_01.models.LeaseContainerRequestAction :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -2734,7 +2733,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class ListContainerItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class ListContainerItem(AzureEntityResource): """The blob container properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -4306,7 +4305,7 @@ def __init__( self.publish_internet_endpoints = publish_internet_endpoints -class ServiceSasParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ServiceSasParameters(_serialization.Model): """The parameters to list service SAS credentials of a specific resource. All required parameters must be populated in order to send to server. @@ -4691,7 +4690,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class StorageAccount(TrackedResource): # pylint: disable=too-many-instance-attributes +class StorageAccount(TrackedResource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. @@ -4983,7 +4982,7 @@ def __init__(self, *, name: str, **kwargs: Any) -> None: self.name = name -class StorageAccountCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountCreateParameters(_serialization.Model): """The parameters used when creating a storage account. All required parameters must be populated in order to send to server. @@ -5380,7 +5379,7 @@ def __init__(self, *, key_name: str, **kwargs: Any) -> None: self.key_name = key_name -class StorageAccountUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountUpdateParameters(_serialization.Model): """The parameters that can be provided when updating the storage account properties. :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_storage_management_client_enums.py index 271d93200c6f..34de227f647d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_storage_management_client_enums.py @@ -215,6 +215,7 @@ class LeaseContainerRequestAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/__init__.py index d796f35045aa..b529831709ad 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/__init__.py @@ -5,28 +5,34 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -49,5 +55,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_containers_operations.py index 26b074873968..a16a6a862cf5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -613,7 +611,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -635,7 +633,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -651,7 +648,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -786,7 +782,7 @@ def create( :rtype: ~azure.mgmt.storage.v2019_06_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -821,7 +817,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -835,11 +830,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -949,7 +940,7 @@ def update( :rtype: ~azure.mgmt.storage.v2019_06_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -984,7 +975,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -998,7 +988,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1027,7 +1017,7 @@ def get( :rtype: ~azure.mgmt.storage.v2019_06_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1050,7 +1040,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1064,7 +1053,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1093,7 +1082,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1116,7 +1105,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1239,7 +1227,7 @@ def set_legal_hold( :rtype: ~azure.mgmt.storage.v2019_06_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1274,7 +1262,6 @@ def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1288,7 +1275,7 @@ def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1398,7 +1385,7 @@ def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2019_06_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1433,7 +1420,6 @@ def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1447,7 +1433,7 @@ def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1586,7 +1572,7 @@ def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1626,7 +1612,6 @@ def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1643,7 +1628,7 @@ def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1686,7 +1671,7 @@ def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1711,7 +1696,6 @@ def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1728,7 +1712,7 @@ def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1773,7 +1757,7 @@ def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1798,7 +1782,6 @@ def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1815,7 +1798,7 @@ def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1849,7 +1832,7 @@ def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1873,7 +1856,6 @@ def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1890,7 +1872,7 @@ def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2020,7 +2002,7 @@ def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2059,7 +2041,6 @@ def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2076,7 +2057,7 @@ def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2186,7 +2167,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2019_06_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2224,7 +2205,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2238,7 +2218,7 @@ def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_inventory_policies_operations.py index 383488aaa12b..f9a00b406b52 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -235,7 +232,7 @@ def get( :rtype: ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +255,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -273,7 +269,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -377,7 +373,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2019_06_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -412,7 +408,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -427,7 +422,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -459,7 +454,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -482,7 +477,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -524,7 +518,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -543,7 +537,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -559,7 +552,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_services_operations.py index 41e0e68b4474..f2304f16fdaa 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -197,7 +194,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -216,7 +213,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -232,7 +228,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -361,7 +356,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2019_06_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -396,7 +391,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -410,7 +404,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -438,7 +432,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2019_06_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -461,7 +455,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -475,7 +468,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_encryption_scopes_operations.py index b224181206c6..b90f6eb98ac2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -315,7 +312,7 @@ def put( :rtype: ~azure.mgmt.storage.v2019_06_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -350,7 +347,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -365,11 +361,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -479,7 +471,7 @@ def patch( :rtype: ~azure.mgmt.storage.v2019_06_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -514,7 +506,6 @@ def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -529,7 +520,7 @@ def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -558,7 +549,7 @@ def get( :rtype: ~azure.mgmt.storage.v2019_06_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -581,7 +572,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -596,7 +586,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -624,7 +614,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -643,7 +633,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -659,7 +648,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_file_services_operations.py index 772b2df7e48d..425d4b6eeab3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2019_06_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +204,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -221,7 +217,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -328,7 +324,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2019_06_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -363,7 +359,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -377,7 +372,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -405,7 +400,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2019_06_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -428,7 +423,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -442,7 +436,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_file_shares_operations.py index fd68206b02f0..3eea0da95c0f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_file_shares_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -333,7 +330,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -355,7 +352,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -371,7 +367,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -506,7 +501,7 @@ def create( :rtype: ~azure.mgmt.storage.v2019_06_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -541,7 +536,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -555,11 +549,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -669,7 +659,7 @@ def update( :rtype: ~azure.mgmt.storage.v2019_06_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -704,7 +694,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -718,7 +707,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -755,7 +744,7 @@ def get( :rtype: ~azure.mgmt.storage.v2019_06_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -779,7 +768,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -793,7 +781,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -822,7 +810,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -845,7 +833,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -863,7 +850,7 @@ def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -898,7 +885,7 @@ def restore( # pylint: disable=inconsistent-return-statements """ @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -961,7 +948,7 @@ def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -996,7 +983,6 @@ def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_management_policies_operations.py index 09fccc66fd88..ee8da8d05022 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -196,7 +193,7 @@ def get( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,7 +216,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -233,7 +229,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +333,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +368,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -386,7 +381,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -418,7 +413,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -441,7 +436,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_object_replication_policies_operations.py index 3f8ed2716e0d..0c75031986b2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -229,7 +226,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -248,7 +245,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -264,7 +260,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -314,7 +309,7 @@ def get( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -337,7 +332,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -352,7 +346,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -456,7 +450,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -491,7 +485,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -506,7 +499,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -533,7 +526,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -556,7 +549,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_operations.py index 848de31c5919..7bb7d7560951 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -126,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_private_endpoint_connections_operations.py index f584679a3829..18827990c907 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -241,7 +238,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,7 +257,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -276,7 +272,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -325,7 +320,7 @@ def get( :rtype: ~azure.mgmt.storage.v2019_06_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +343,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -363,7 +357,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +458,7 @@ def put( :rtype: ~azure.mgmt.storage.v2019_06_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +493,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -514,7 +507,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -541,7 +534,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -564,7 +557,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_private_link_resources_operations.py index c081e4990f0b..9a138165a0a3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -109,7 +106,7 @@ def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2019_06_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -131,7 +128,6 @@ def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -145,7 +141,7 @@ def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_queue_operations.py index ef778e515b97..108047675cd8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -375,7 +372,7 @@ def create( :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -410,7 +407,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -424,7 +420,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -531,7 +527,7 @@ def update( :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +562,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -580,7 +575,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -607,7 +602,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -630,7 +625,6 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -644,7 +638,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -673,7 +667,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -696,7 +690,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -747,7 +740,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -768,7 +761,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -784,7 +776,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_queue_services_operations.py index 46a31e5e7a59..743f7df7ad6e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2019_06_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +204,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -221,7 +217,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -328,7 +324,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2019_06_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -363,7 +359,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -377,7 +372,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -405,7 +400,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2019_06_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -428,7 +423,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -442,7 +436,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_skus_operations.py index ede0ac1a0502..780cf0bc2a45 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_storage_accounts_operations.py index 3c90c87564a3..713f70aaf8ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -582,7 +582,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2019_06_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -614,7 +614,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -628,7 +627,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -641,8 +640,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -655,7 +654,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -676,10 +675,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -687,12 +686,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -815,10 +816,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -857,7 +859,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -879,7 +881,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -924,7 +925,7 @@ def get_properties( :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -947,7 +948,6 @@ def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -961,7 +961,7 @@ def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1072,7 +1072,7 @@ def update( :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1106,7 +1106,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1120,7 +1119,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1142,7 +1141,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1159,7 +1158,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1175,7 +1173,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1222,7 +1219,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1240,7 +1237,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1256,7 +1252,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1306,7 +1301,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1329,7 +1324,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1343,7 +1337,7 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1437,7 +1431,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2019_06_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1471,7 +1465,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1485,7 +1478,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1576,7 +1569,7 @@ def list_account_sas( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1610,7 +1603,6 @@ def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1624,7 +1616,7 @@ def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1713,7 +1705,7 @@ def list_service_sas( :rtype: ~azure.mgmt.storage.v2019_06_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1747,7 +1739,6 @@ def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1761,17 +1752,15 @@ def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _failover_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _failover_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1783,7 +1772,7 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1793,10 +1782,10 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1804,11 +1793,19 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1836,7 +1833,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._failover_initial( # type: ignore + raw_result = self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1845,6 +1842,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1874,8 +1872,8 @@ def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1888,7 +1886,7 @@ def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1909,10 +1907,10 @@ def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1920,14 +1918,14 @@ def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2040,10 +2038,11 @@ def begin_restore_blob_ranges( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2084,7 +2083,7 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2106,7 +2105,6 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_table_operations.py index a1d00fa23277..cfed91cd3a61 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -255,7 +252,7 @@ def create(self, resource_group_name: str, account_name: str, table_name: str, * :rtype: ~azure.mgmt.storage.v2019_06_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -278,7 +275,6 @@ def create(self, resource_group_name: str, account_name: str, table_name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -292,7 +288,7 @@ def create(self, resource_group_name: str, account_name: str, table_name: str, * map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -318,7 +314,7 @@ def update(self, resource_group_name: str, account_name: str, table_name: str, * :rtype: ~azure.mgmt.storage.v2019_06_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -341,7 +337,6 @@ def update(self, resource_group_name: str, account_name: str, table_name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -355,7 +350,7 @@ def update(self, resource_group_name: str, account_name: str, table_name: str, * map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -381,7 +376,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw :rtype: ~azure.mgmt.storage.v2019_06_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -404,7 +399,6 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -418,7 +412,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -446,7 +440,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -469,7 +463,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -507,7 +500,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -526,7 +519,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -542,7 +534,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_table_services_operations.py index dce21ddd62f1..1fde1b624d4b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2019_06_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +204,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -221,7 +217,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -328,7 +324,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2019_06_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -363,7 +359,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -377,7 +372,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -405,7 +400,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2019_06_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -428,7 +423,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -442,7 +436,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_usages_operations.py index f58068ac963b..0090323d3686 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -105,7 +102,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.Us api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-06-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -139,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/__init__.py index a860a5c185c9..60980065e1ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_configuration.py index 4a0b3e35fc17..ed3f1b53e8b7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_metadata.json index aa914ce4517e..3c7204ca37de 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_storage_management_client.py index a43fa08fb3ec..e44c372cd20f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -40,11 +41,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -226,7 +226,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_version.py index 5a163c0afedc..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" \ No newline at end of file +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/__init__.py index a5c3d2414cfd..ee2b940bd4fc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/_configuration.py index bdc48c02393e..69766daffaeb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/_storage_management_client.py index 483b44c7d8ca..85cd0c9ced36 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -40,11 +41,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -229,7 +229,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/__init__.py index 0f201012e160..d406c5bf4d6b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/__init__.py @@ -5,29 +5,35 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -51,5 +57,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_containers_operations.py index f98aac7ed733..6b03d90bc6fe 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_containers_operations import ( build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, @@ -49,7 +47,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -116,7 +114,7 @@ def list( ) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -138,7 +136,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -154,7 +151,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -289,7 +285,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -326,7 +322,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -340,11 +335,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -454,7 +445,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -491,7 +482,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -505,7 +495,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -534,7 +524,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -559,7 +549,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -573,7 +562,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -581,9 +570,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -602,7 +589,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -627,7 +614,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -750,7 +736,7 @@ async def set_legal_hold( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -787,7 +773,6 @@ async def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -801,7 +786,7 @@ async def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -911,7 +896,7 @@ async def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -948,7 +933,6 @@ async def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -962,7 +946,7 @@ async def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1102,7 +1086,7 @@ async def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1144,7 +1128,6 @@ async def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1161,7 +1144,7 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1204,7 +1187,7 @@ async def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1231,7 +1214,6 @@ async def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1248,7 +1230,7 @@ async def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1293,7 +1275,7 @@ async def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1320,7 +1302,6 @@ async def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1337,7 +1318,7 @@ async def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1371,7 +1352,7 @@ async def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1397,7 +1378,6 @@ async def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1414,7 +1394,7 @@ async def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1545,7 +1525,7 @@ async def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1586,7 +1566,6 @@ async def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1603,7 +1582,7 @@ async def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1714,7 +1693,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1754,7 +1733,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1768,7 +1746,7 @@ async def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_inventory_policies_operations.py index b98a53175929..642e35957084 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_inventory_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -115,7 +112,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -130,7 +126,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -235,7 +231,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -272,7 +268,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -287,7 +282,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -295,7 +290,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -319,7 +314,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -344,7 +339,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -388,7 +382,7 @@ def list( ) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -407,7 +401,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -423,7 +416,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_services_operations.py index bcd6febea05d..ecd98dee4746 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_services_operations import ( build_get_service_properties_request, build_list_request, @@ -39,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -91,7 +88,7 @@ def list( ) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -126,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -256,7 +251,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -293,7 +288,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -307,7 +301,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -335,7 +329,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -360,7 +354,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -374,7 +367,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_deleted_accounts_operations.py index c3602679dd2d..86744136ce00 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,21 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_accounts_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DeletedAccount"]: ) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -109,7 +105,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -151,7 +146,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,7 +170,6 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -190,7 +184,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_encryption_scopes_operations.py index f619f3c3646c..bff1b304008a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._encryption_scopes_operations import ( build_get_request, build_list_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -174,7 +171,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -211,7 +208,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -226,11 +222,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -341,7 +333,7 @@ async def patch( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -378,7 +370,6 @@ async def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -393,7 +384,7 @@ async def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -422,7 +413,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -447,7 +438,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -462,7 +452,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -495,7 +485,7 @@ def list( ) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -514,7 +504,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -530,7 +519,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_file_services_operations.py index e64ba9df11df..5dbfc39be4be 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,7 +97,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -114,7 +110,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -222,7 +218,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -259,7 +255,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -273,7 +268,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -301,7 +296,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -326,7 +321,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -340,7 +334,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_file_shares_operations.py index 2118a2e7f253..0c96eaf0b25d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_file_shares_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_shares_operations import ( build_create_request, build_delete_request, @@ -42,7 +39,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -108,7 +105,7 @@ def list( ) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -130,7 +127,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -146,7 +142,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -293,7 +288,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +326,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -345,11 +339,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -459,7 +449,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -496,7 +486,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -510,7 +499,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -551,7 +540,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -578,7 +567,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -592,7 +580,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -600,7 +588,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -628,7 +616,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -654,7 +642,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -672,7 +659,7 @@ async def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -707,7 +694,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -742,7 +729,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -770,7 +757,7 @@ async def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -807,7 +794,6 @@ async def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_management_policies_operations.py index 4ac109494771..8ca1c76327b0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._management_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -111,7 +108,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -125,7 +121,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -229,7 +225,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -266,7 +262,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -280,7 +275,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -288,7 +283,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -312,7 +307,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -337,7 +332,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_object_replication_policies_operations.py index 79a71a5f1b54..659696763903 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._object_replication_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -92,7 +89,7 @@ def list( ) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -111,7 +108,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -127,7 +123,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -177,7 +172,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -202,7 +197,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -217,7 +211,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -322,7 +316,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -359,7 +353,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -374,7 +367,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -382,7 +375,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, object_replication_policy_id: str, **kwargs: Any ) -> None: """Deletes the object replication policy associated with the specified storage account. @@ -401,7 +394,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -426,7 +419,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_operations.py index 4835404a9ab8..41d32f5e8c79 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +72,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +88,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -107,7 +103,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_private_endpoint_connections_operations.py index 58c3267e41bc..7149a6210d6e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connections_operations import ( build_delete_request, build_get_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,6 +66,7 @@ def __init__(self, *args, **kwargs) -> None: def list( self, resource_group_name: str, account_name: str, **kwargs: Any ) -> AsyncIterable["_models.PrivateEndpointConnection"]: + # pylint: disable=line-too-long """List all the private endpoint connections associated with the storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -92,7 +90,7 @@ def list( ) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -111,7 +109,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -127,7 +124,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -176,7 +172,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +197,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -216,7 +211,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -318,7 +313,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -355,7 +350,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -370,7 +364,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -378,7 +372,7 @@ async def put( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: """Deletes the specified private endpoint connection associated with the storage account. @@ -397,7 +391,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -422,7 +416,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_private_link_resources_operations.py index 73610cec0dcb..985aee1569e9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_by_storage_account_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ async def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,7 +94,6 @@ async def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -111,7 +107,7 @@ async def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_queue_operations.py index 05788b2ca6dc..c8551e56695d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_operations import ( build_create_request, build_delete_request, @@ -41,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -166,7 +163,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -203,7 +200,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -217,7 +213,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -324,7 +320,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -361,7 +357,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -375,7 +370,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -404,7 +399,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -429,7 +424,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -443,7 +437,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -451,9 +445,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any) -> None: """Deletes the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -472,7 +464,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -497,7 +489,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -551,7 +542,7 @@ def list( ) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -572,7 +563,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -588,7 +578,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_queue_services_operations.py index 6d01f35b496e..71f33fb1e79a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,7 +97,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -114,7 +110,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -222,7 +218,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -259,7 +255,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -273,7 +268,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -301,7 +296,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -326,7 +321,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -340,7 +334,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_skus_operations.py index b3bb656f8255..e3b90660bd89 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +72,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SkuInformation"]: ) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -92,7 +89,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -108,7 +104,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_storage_accounts_operations.py index 363b88ab9e6c..8557245fcc20 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_check_name_availability_request, build_create_request, @@ -52,7 +65,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -135,7 +148,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -169,7 +182,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -183,7 +195,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -196,8 +208,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -212,7 +224,7 @@ async def _create_initial( "api_version", _params.pop("api-version", self._api_version or "2020-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -233,10 +245,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -244,12 +256,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -377,10 +391,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -403,9 +418,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -419,7 +432,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -443,7 +456,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -488,7 +500,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -513,7 +525,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -527,7 +538,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -638,7 +649,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -674,7 +685,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -688,7 +698,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -713,7 +723,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: ) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -730,7 +740,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -746,7 +755,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -798,7 +806,7 @@ def list_by_resource_group( ) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -816,7 +824,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -832,7 +839,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -882,7 +888,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -907,7 +913,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -921,7 +926,7 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1016,7 +1021,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1052,7 +1057,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1066,7 +1070,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1158,7 +1162,7 @@ async def list_account_sas( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1194,7 +1198,6 @@ async def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1208,7 +1211,7 @@ async def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1298,7 +1301,7 @@ async def list_service_sas( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1334,7 +1337,6 @@ async def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1348,17 +1350,17 @@ async def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _failover_initial( # pylint: disable=inconsistent-return-statements + async def _failover_initial( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1372,7 +1374,7 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop( "api_version", _params.pop("api-version", self._api_version or "2020-08-01-preview") ) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1382,10 +1384,10 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1393,11 +1395,19 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1427,7 +1437,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._failover_initial( # type: ignore + raw_result = await self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1436,6 +1446,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1465,8 +1476,8 @@ async def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1481,7 +1492,7 @@ async def _restore_blob_ranges_initial( "api_version", _params.pop("api-version", self._api_version or "2020-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1502,10 +1513,10 @@ async def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1513,14 +1524,14 @@ async def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1639,10 +1650,11 @@ async def begin_restore_blob_ranges( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1667,9 +1679,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def revoke_user_delegation_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1683,7 +1693,7 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1707,7 +1717,6 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_table_operations.py index 443e4d78b252..b9b38067c495 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_operations import ( build_create_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -111,7 +108,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -125,7 +121,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -153,7 +149,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -178,7 +174,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -192,7 +187,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -218,7 +213,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +238,6 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -257,7 +251,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -265,9 +259,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any) -> None: """Deletes the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -285,7 +277,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -310,7 +302,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -351,7 +342,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As ) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -370,7 +361,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -386,7 +376,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_table_services_operations.py index a45a3c823c00..af1d2156eb72 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,7 +97,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -114,7 +110,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -222,7 +218,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -259,7 +255,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -273,7 +268,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -301,7 +296,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -326,7 +321,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -340,7 +334,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_usages_operations.py index ffc4af115fde..7bba46c4c5e2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/aio/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usages_operations import build_list_by_location_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +75,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_mode ) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -112,7 +108,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/__init__.py index 9e18bee7a8b2..f72ebbf8936f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/__init__.py @@ -5,188 +5,199 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccountSasParameters -from ._models_py3 import ActiveDirectoryProperties -from ._models_py3 import AzureEntityResource -from ._models_py3 import AzureFilesIdentityBasedAuthentication -from ._models_py3 import BlobContainer -from ._models_py3 import BlobInventoryPolicy -from ._models_py3 import BlobInventoryPolicyDefinition -from ._models_py3 import BlobInventoryPolicyFilter -from ._models_py3 import BlobInventoryPolicyRule -from ._models_py3 import BlobInventoryPolicySchema -from ._models_py3 import BlobRestoreParameters -from ._models_py3 import BlobRestoreRange -from ._models_py3 import BlobRestoreStatus -from ._models_py3 import BlobServiceItems -from ._models_py3 import BlobServiceProperties -from ._models_py3 import ChangeFeed -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CloudErrorBody -from ._models_py3 import CorsRule -from ._models_py3 import CorsRules -from ._models_py3 import CustomDomain -from ._models_py3 import DateAfterCreation -from ._models_py3 import DateAfterModification -from ._models_py3 import DeleteRetentionPolicy -from ._models_py3 import DeletedAccount -from ._models_py3 import DeletedAccountListResult -from ._models_py3 import DeletedShare -from ._models_py3 import Dimension -from ._models_py3 import Encryption -from ._models_py3 import EncryptionScope -from ._models_py3 import EncryptionScopeKeyVaultProperties -from ._models_py3 import EncryptionScopeListResult -from ._models_py3 import EncryptionService -from ._models_py3 import EncryptionServices -from ._models_py3 import Endpoints -from ._models_py3 import ErrorResponse -from ._models_py3 import ErrorResponseBody -from ._models_py3 import ExtendedLocation -from ._models_py3 import FileServiceItems -from ._models_py3 import FileServiceProperties -from ._models_py3 import FileShare -from ._models_py3 import FileShareItem -from ._models_py3 import FileShareItems -from ._models_py3 import GeoReplicationStats -from ._models_py3 import IPRule -from ._models_py3 import Identity -from ._models_py3 import ImmutabilityPolicy -from ._models_py3 import ImmutabilityPolicyProperties -from ._models_py3 import KeyVaultProperties -from ._models_py3 import LastAccessTimeTrackingPolicy -from ._models_py3 import LeaseContainerRequest -from ._models_py3 import LeaseContainerResponse -from ._models_py3 import LegalHold -from ._models_py3 import LegalHoldProperties -from ._models_py3 import ListAccountSasResponse -from ._models_py3 import ListBlobInventoryPolicy -from ._models_py3 import ListContainerItem -from ._models_py3 import ListContainerItems -from ._models_py3 import ListQueue -from ._models_py3 import ListQueueResource -from ._models_py3 import ListQueueServices -from ._models_py3 import ListServiceSasResponse -from ._models_py3 import ListTableResource -from ._models_py3 import ListTableServices -from ._models_py3 import ManagementPolicy -from ._models_py3 import ManagementPolicyAction -from ._models_py3 import ManagementPolicyBaseBlob -from ._models_py3 import ManagementPolicyDefinition -from ._models_py3 import ManagementPolicyFilter -from ._models_py3 import ManagementPolicyRule -from ._models_py3 import ManagementPolicySchema -from ._models_py3 import ManagementPolicySnapShot -from ._models_py3 import ManagementPolicyVersion -from ._models_py3 import MetricSpecification -from ._models_py3 import Multichannel -from ._models_py3 import NetworkRuleSet -from ._models_py3 import ObjectReplicationPolicies -from ._models_py3 import ObjectReplicationPolicy -from ._models_py3 import ObjectReplicationPolicyFilter -from ._models_py3 import ObjectReplicationPolicyRule -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import PrivateEndpoint -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionListResult -from ._models_py3 import PrivateLinkResource -from ._models_py3 import PrivateLinkResourceListResult -from ._models_py3 import PrivateLinkServiceConnectionState -from ._models_py3 import ProtocolSettings -from ._models_py3 import ProxyResource -from ._models_py3 import QueueServiceProperties -from ._models_py3 import Resource -from ._models_py3 import ResourceAccessRule -from ._models_py3 import RestorePolicyProperties -from ._models_py3 import Restriction -from ._models_py3 import RoutingPreference -from ._models_py3 import SKUCapability -from ._models_py3 import ServiceSasParameters -from ._models_py3 import ServiceSpecification -from ._models_py3 import Sku -from ._models_py3 import SkuInformation -from ._models_py3 import SmbSetting -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountInternetEndpoints -from ._models_py3 import StorageAccountKey -from ._models_py3 import StorageAccountListKeysResult -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountMicrosoftEndpoints -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import StorageQueue -from ._models_py3 import StorageSkuListResult -from ._models_py3 import SystemData -from ._models_py3 import Table -from ._models_py3 import TableServiceProperties -from ._models_py3 import TagFilter -from ._models_py3 import TagProperty -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateHistoryProperty -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._storage_management_client_enums import AccessTier -from ._storage_management_client_enums import AccountStatus -from ._storage_management_client_enums import BlobInventoryPolicyName -from ._storage_management_client_enums import BlobRestoreProgressStatus -from ._storage_management_client_enums import Bypass -from ._storage_management_client_enums import CorsRuleAllowedMethodsItem -from ._storage_management_client_enums import CreatedByType -from ._storage_management_client_enums import DefaultAction -from ._storage_management_client_enums import DirectoryServiceOptions -from ._storage_management_client_enums import EnabledProtocols -from ._storage_management_client_enums import EncryptionScopeSource -from ._storage_management_client_enums import EncryptionScopeState -from ._storage_management_client_enums import Enum28 -from ._storage_management_client_enums import ExtendedLocationTypes -from ._storage_management_client_enums import GeoReplicationStatus -from ._storage_management_client_enums import HttpProtocol -from ._storage_management_client_enums import ImmutabilityPolicyState -from ._storage_management_client_enums import ImmutabilityPolicyUpdateType -from ._storage_management_client_enums import InventoryRuleType -from ._storage_management_client_enums import KeyPermission -from ._storage_management_client_enums import KeySource -from ._storage_management_client_enums import KeyType -from ._storage_management_client_enums import Kind -from ._storage_management_client_enums import LargeFileSharesState -from ._storage_management_client_enums import LeaseContainerRequestAction -from ._storage_management_client_enums import LeaseDuration -from ._storage_management_client_enums import LeaseState -from ._storage_management_client_enums import LeaseStatus -from ._storage_management_client_enums import ListContainersInclude -from ._storage_management_client_enums import ListSharesExpand -from ._storage_management_client_enums import ManagementPolicyName -from ._storage_management_client_enums import MinimumTlsVersion -from ._storage_management_client_enums import Name -from ._storage_management_client_enums import Permissions -from ._storage_management_client_enums import PrivateEndpointConnectionProvisioningState -from ._storage_management_client_enums import PrivateEndpointServiceConnectionStatus -from ._storage_management_client_enums import ProvisioningState -from ._storage_management_client_enums import PublicAccess -from ._storage_management_client_enums import Reason -from ._storage_management_client_enums import ReasonCode -from ._storage_management_client_enums import RootSquashType -from ._storage_management_client_enums import RoutingChoice -from ._storage_management_client_enums import RuleType -from ._storage_management_client_enums import Services -from ._storage_management_client_enums import ShareAccessTier -from ._storage_management_client_enums import SignedResource -from ._storage_management_client_enums import SignedResourceTypes -from ._storage_management_client_enums import SkuName -from ._storage_management_client_enums import SkuTier -from ._storage_management_client_enums import State -from ._storage_management_client_enums import StorageAccountExpand -from ._storage_management_client_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccountSasParameters, + ActiveDirectoryProperties, + AzureEntityResource, + AzureFilesIdentityBasedAuthentication, + BlobContainer, + BlobInventoryPolicy, + BlobInventoryPolicyDefinition, + BlobInventoryPolicyFilter, + BlobInventoryPolicyRule, + BlobInventoryPolicySchema, + BlobRestoreParameters, + BlobRestoreRange, + BlobRestoreStatus, + BlobServiceItems, + BlobServiceProperties, + ChangeFeed, + CheckNameAvailabilityResult, + CloudErrorBody, + CorsRule, + CorsRules, + CustomDomain, + DateAfterCreation, + DateAfterModification, + DeleteRetentionPolicy, + DeletedAccount, + DeletedAccountListResult, + DeletedShare, + Dimension, + Encryption, + EncryptionScope, + EncryptionScopeKeyVaultProperties, + EncryptionScopeListResult, + EncryptionService, + EncryptionServices, + Endpoints, + ErrorResponse, + ErrorResponseBody, + ExtendedLocation, + FileServiceItems, + FileServiceProperties, + FileShare, + FileShareItem, + FileShareItems, + GeoReplicationStats, + IPRule, + Identity, + ImmutabilityPolicy, + ImmutabilityPolicyProperties, + KeyVaultProperties, + LastAccessTimeTrackingPolicy, + LeaseContainerRequest, + LeaseContainerResponse, + LegalHold, + LegalHoldProperties, + ListAccountSasResponse, + ListBlobInventoryPolicy, + ListContainerItem, + ListContainerItems, + ListQueue, + ListQueueResource, + ListQueueServices, + ListServiceSasResponse, + ListTableResource, + ListTableServices, + ManagementPolicy, + ManagementPolicyAction, + ManagementPolicyBaseBlob, + ManagementPolicyDefinition, + ManagementPolicyFilter, + ManagementPolicyRule, + ManagementPolicySchema, + ManagementPolicySnapShot, + ManagementPolicyVersion, + MetricSpecification, + Multichannel, + NetworkRuleSet, + ObjectReplicationPolicies, + ObjectReplicationPolicy, + ObjectReplicationPolicyFilter, + ObjectReplicationPolicyRule, + Operation, + OperationDisplay, + OperationListResult, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionListResult, + PrivateLinkResource, + PrivateLinkResourceListResult, + PrivateLinkServiceConnectionState, + ProtocolSettings, + ProxyResource, + QueueServiceProperties, + Resource, + ResourceAccessRule, + RestorePolicyProperties, + Restriction, + RoutingPreference, + SKUCapability, + ServiceSasParameters, + ServiceSpecification, + Sku, + SkuInformation, + SmbSetting, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountInternetEndpoints, + StorageAccountKey, + StorageAccountListKeysResult, + StorageAccountListResult, + StorageAccountMicrosoftEndpoints, + StorageAccountRegenerateKeyParameters, + StorageAccountUpdateParameters, + StorageQueue, + StorageSkuListResult, + SystemData, + Table, + TableServiceProperties, + TagFilter, + TagProperty, + TrackedResource, + UpdateHistoryProperty, + Usage, + UsageListResult, + UsageName, + VirtualNetworkRule, +) + +from ._storage_management_client_enums import ( # type: ignore + AccessTier, + AccountStatus, + BlobInventoryPolicyName, + BlobRestoreProgressStatus, + Bypass, + CorsRuleAllowedMethodsItem, + CreatedByType, + DefaultAction, + DirectoryServiceOptions, + EnabledProtocols, + EncryptionScopeSource, + EncryptionScopeState, + Enum28, + ExtendedLocationTypes, + GeoReplicationStatus, + HttpProtocol, + ImmutabilityPolicyState, + ImmutabilityPolicyUpdateType, + InventoryRuleType, + KeyPermission, + KeySource, + KeyType, + Kind, + LargeFileSharesState, + LeaseContainerRequestAction, + LeaseDuration, + LeaseState, + LeaseStatus, + ListContainersInclude, + ListSharesExpand, + ManagementPolicyName, + MinimumTlsVersion, + Name, + Permissions, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProvisioningState, + PublicAccess, + Reason, + ReasonCode, + RootSquashType, + RoutingChoice, + RuleType, + Services, + ShareAccessTier, + SignedResource, + SignedResourceTypes, + SkuName, + SkuTier, + State, + StorageAccountExpand, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -369,5 +380,5 @@ "StorageAccountExpand", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/_models_py3.py index acc1698eb30c..4009528a4dfc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,7 +13,6 @@ from ... import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -311,7 +310,7 @@ def __init__( self.active_directory_properties = active_directory_properties -class BlobContainer(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class BlobContainer(AzureEntityResource): """Properties of the blob container, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -824,7 +823,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class BlobServiceProperties(Resource): # pylint: disable=too-many-instance-attributes +class BlobServiceProperties(Resource): """The properties of a storage account’s Blob service. Variables are only populated by the server, and will be ignored when sending a request. @@ -2018,7 +2017,7 @@ def __init__( self.protocol_settings = protocol_settings -class FileShare(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShare(AzureEntityResource): """Properties of the file share, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -2154,7 +2153,7 @@ def __init__( self.snapshot_time = None -class FileShareItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShareItem(AzureEntityResource): """The file share properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -2695,7 +2694,7 @@ class LeaseContainerRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2020_08_01_preview.models.LeaseContainerRequestAction :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. @@ -2735,7 +2734,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2020_08_01_preview.models.LeaseContainerRequestAction :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. @@ -2905,7 +2904,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class ListContainerItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class ListContainerItem(AzureEntityResource): """The blob container properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -4561,7 +4560,7 @@ def __init__( self.publish_internet_endpoints = publish_internet_endpoints -class ServiceSasParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ServiceSasParameters(_serialization.Model): """The parameters to list service SAS credentials of a specific resource. All required parameters must be populated in order to send to server. @@ -4966,7 +4965,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class StorageAccount(TrackedResource): # pylint: disable=too-many-instance-attributes +class StorageAccount(TrackedResource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. @@ -5270,7 +5269,7 @@ def __init__(self, *, name: str, **kwargs: Any) -> None: self.name = name -class StorageAccountCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountCreateParameters(_serialization.Model): """The parameters used when creating a storage account. All required parameters must be populated in order to send to server. @@ -5680,7 +5679,7 @@ def __init__(self, *, key_name: str, **kwargs: Any) -> None: self.key_name = key_name -class StorageAccountUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountUpdateParameters(_serialization.Model): """The parameters that can be provided when updating the storage account properties. :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/_storage_management_client_enums.py index f688469021e7..a82ef09b3b72 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/_storage_management_client_enums.py @@ -221,6 +221,7 @@ class LeaseContainerRequestAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/__init__.py index 0f201012e160..d406c5bf4d6b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/__init__.py @@ -5,29 +5,35 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -51,5 +57,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_containers_operations.py index 2c4ecd8123c4..08675aefaab3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -616,7 +614,7 @@ def list( ) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -638,7 +636,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -654,7 +651,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -789,7 +785,7 @@ def create( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -826,7 +822,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -840,11 +835,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -954,7 +945,7 @@ def update( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -991,7 +982,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1005,7 +995,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1034,7 +1024,7 @@ def get( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1059,7 +1049,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1073,7 +1062,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1102,7 +1091,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1127,7 +1116,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1250,7 +1238,7 @@ def set_legal_hold( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1287,7 +1275,6 @@ def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1301,7 +1288,7 @@ def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1411,7 +1398,7 @@ def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1448,7 +1435,6 @@ def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1462,7 +1448,7 @@ def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1602,7 +1588,7 @@ def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1644,7 +1630,6 @@ def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1661,7 +1646,7 @@ def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1704,7 +1689,7 @@ def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1731,7 +1716,6 @@ def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1748,7 +1732,7 @@ def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1793,7 +1777,7 @@ def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1820,7 +1804,6 @@ def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1837,7 +1820,7 @@ def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1871,7 +1854,7 @@ def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1897,7 +1880,6 @@ def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1914,7 +1896,7 @@ def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2045,7 +2027,7 @@ def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2086,7 +2068,6 @@ def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2103,7 +2084,7 @@ def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2214,7 +2195,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2254,7 +2235,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2268,7 +2248,7 @@ def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_inventory_policies_operations.py index 053fd6adda7e..d648318a4ae2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -235,7 +232,7 @@ def get( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,7 +257,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -275,7 +271,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -380,7 +376,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -417,7 +413,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -432,7 +427,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +459,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -489,7 +484,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -533,7 +527,7 @@ def list( ) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -552,7 +546,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -568,7 +561,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_services_operations.py index aa511729e290..bdd8b227e2ad 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -199,7 +196,7 @@ def list( ) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -218,7 +215,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -234,7 +230,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -364,7 +359,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -401,7 +396,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -415,7 +409,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -443,7 +437,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -468,7 +462,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -482,7 +475,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_deleted_accounts_operations.py index 432f4d79565b..52cd3a87cba2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -133,7 +130,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.DeletedAccount"]: ) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -150,7 +147,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -166,7 +162,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -208,7 +203,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -232,7 +227,6 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -247,7 +241,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_encryption_scopes_operations.py index 4e05f0076ced..a86c2a50b936 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -316,7 +313,7 @@ def put( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,7 +350,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -368,11 +364,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -483,7 +475,7 @@ def patch( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -520,7 +512,6 @@ def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -535,7 +526,7 @@ def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -564,7 +555,7 @@ def get( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -589,7 +580,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -604,7 +594,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -635,7 +625,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It ) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -654,7 +644,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -670,7 +659,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_file_services_operations.py index 11490693aa44..feac5bd72136 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -209,7 +206,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -223,7 +219,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -331,7 +327,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -368,7 +364,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -382,7 +377,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -410,7 +405,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -435,7 +430,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -449,7 +443,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_file_shares_operations.py index 98b4e75641aa..4c28511209d9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_file_shares_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -355,7 +353,7 @@ def list( ) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -377,7 +375,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -393,7 +390,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -540,7 +536,7 @@ def create( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -578,7 +574,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -592,11 +587,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -706,7 +697,7 @@ def update( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -743,7 +734,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -757,7 +747,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -798,7 +788,7 @@ def get( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -825,7 +815,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -839,7 +828,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -875,7 +864,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -901,7 +890,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -919,7 +907,7 @@ def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -954,7 +942,7 @@ def restore( # pylint: disable=inconsistent-return-statements """ @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -1017,7 +1005,7 @@ def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1054,7 +1042,6 @@ def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_management_policies_operations.py index 6720a9832d70..b8d29c6540ca 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -196,7 +193,7 @@ def get( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -221,7 +218,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -235,7 +231,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -339,7 +335,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -376,7 +372,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -390,7 +385,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -422,7 +417,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -447,7 +442,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_object_replication_policies_operations.py index 4d707556f90d..2f4c1b482c00 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -231,7 +228,7 @@ def list( ) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -250,7 +247,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -266,7 +262,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -316,7 +311,7 @@ def get( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -341,7 +336,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -356,7 +350,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -461,7 +455,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -498,7 +492,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -513,7 +506,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -540,7 +533,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -565,7 +558,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_operations.py index 7b73a6dd1a02..028210875f5b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -96,7 +93,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,7 +109,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -128,7 +124,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_private_endpoint_connections_operations.py index f310a52a533a..fa0054c1fbd9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -243,7 +240,7 @@ def list( ) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -262,7 +259,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -278,7 +274,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -327,7 +322,7 @@ def get( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -352,7 +347,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -367,7 +361,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -469,7 +463,7 @@ def put( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -506,7 +500,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -521,7 +514,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -548,7 +541,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -573,7 +566,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_private_link_resources_operations.py index de7e85b96b79..9c298958d11f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -109,7 +106,7 @@ def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -133,7 +130,6 @@ def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -147,7 +143,7 @@ def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_queue_operations.py index baeb858ecda8..085d4db50b9b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -375,7 +372,7 @@ def create( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -412,7 +409,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -426,7 +422,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -533,7 +529,7 @@ def update( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -570,7 +566,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -584,7 +579,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -611,7 +606,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -636,7 +631,6 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -650,7 +644,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -679,7 +673,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -704,7 +698,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -757,7 +750,7 @@ def list( ) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -778,7 +771,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -794,7 +786,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_queue_services_operations.py index 766890055fd7..b1983fa4399d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -209,7 +206,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -223,7 +219,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -331,7 +327,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -368,7 +364,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -382,7 +377,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -410,7 +405,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -435,7 +430,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -449,7 +443,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_skus_operations.py index 1f19454fe810..543967021518 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -102,7 +99,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SkuInformation"]: ) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -119,7 +116,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -135,7 +131,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_storage_accounts_operations.py index 0f057452d61c..6349a7db870f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -582,7 +582,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -616,7 +616,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -630,7 +629,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -643,8 +642,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -659,7 +658,7 @@ def _create_initial( "api_version", _params.pop("api-version", self._api_version or "2020-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -680,10 +679,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -691,12 +690,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -824,10 +825,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -866,7 +868,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -890,7 +892,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -935,7 +936,7 @@ def get_properties( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -960,7 +961,6 @@ def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -974,7 +974,7 @@ def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1085,7 +1085,7 @@ def update( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1121,7 +1121,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1135,7 +1134,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1160,7 +1159,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: ) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1177,7 +1176,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1193,7 +1191,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1243,7 +1240,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite ) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1261,7 +1258,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1277,7 +1273,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1327,7 +1322,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1352,7 +1347,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1366,7 +1360,7 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1461,7 +1455,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1497,7 +1491,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1511,7 +1504,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1603,7 +1596,7 @@ def list_account_sas( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1639,7 +1632,6 @@ def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1653,7 +1645,7 @@ def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1743,7 +1735,7 @@ def list_service_sas( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1779,7 +1771,6 @@ def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1793,17 +1784,15 @@ def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _failover_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _failover_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1817,7 +1806,7 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop( "api_version", _params.pop("api-version", self._api_version or "2020-08-01-preview") ) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1827,10 +1816,10 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1838,11 +1827,19 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1872,7 +1869,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._failover_initial( # type: ignore + raw_result = self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1881,6 +1878,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1910,8 +1908,8 @@ def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1926,7 +1924,7 @@ def _restore_blob_ranges_initial( "api_version", _params.pop("api-version", self._api_version or "2020-08-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1947,10 +1945,10 @@ def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1958,14 +1956,14 @@ def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2084,10 +2082,11 @@ def begin_restore_blob_ranges( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2128,7 +2127,7 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2152,7 +2151,6 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_table_operations.py index 6b27ec5041ec..29480d8fe8ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -255,7 +252,7 @@ def create(self, resource_group_name: str, account_name: str, table_name: str, * :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -280,7 +277,6 @@ def create(self, resource_group_name: str, account_name: str, table_name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -294,7 +290,7 @@ def create(self, resource_group_name: str, account_name: str, table_name: str, * map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -320,7 +316,7 @@ def update(self, resource_group_name: str, account_name: str, table_name: str, * :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -345,7 +341,6 @@ def update(self, resource_group_name: str, account_name: str, table_name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -359,7 +354,7 @@ def update(self, resource_group_name: str, account_name: str, table_name: str, * map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -385,7 +380,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -410,7 +405,6 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -424,7 +418,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -452,7 +446,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -477,7 +471,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -517,7 +510,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It ) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -536,7 +529,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -552,7 +544,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_table_services_operations.py index d8a3129774f8..fb950a5852c0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -209,7 +206,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -223,7 +219,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -331,7 +327,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -368,7 +364,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -382,7 +377,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -410,7 +405,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2020_08_01_preview.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -435,7 +430,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -449,7 +443,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_usages_operations.py index 12031d9e1fad..89910bc7a37f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -107,7 +104,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.Us ) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -125,7 +122,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -141,7 +137,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/__init__.py index a860a5c185c9..60980065e1ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_configuration.py index e7e0e3cbd4d9..8fd3e72d5060 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_metadata.json index 7cadc332e43e..040b4a2a88ac 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_storage_management_client.py index 0fe4ab7a9b91..0b3b6fd8178c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -40,11 +41,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -211,7 +211,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_version.py index 5a163c0afedc..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" \ No newline at end of file +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/__init__.py index a5c3d2414cfd..ee2b940bd4fc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/_configuration.py index f4f55b7f48b7..aa00151e2cab 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/_storage_management_client.py index 53cf790d9446..d59f6f75108b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -40,11 +41,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -216,7 +216,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/__init__.py index 0f201012e160..d406c5bf4d6b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/__init__.py @@ -5,29 +5,35 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -51,5 +57,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_containers_operations.py index 21bf97210bdf..2ee9d25280b5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_containers_operations import ( build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, @@ -49,7 +47,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -114,7 +112,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -136,7 +134,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -152,7 +149,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -287,7 +283,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_01_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -322,7 +318,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -336,11 +331,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -450,7 +441,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_01_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -485,7 +476,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -499,7 +489,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -528,7 +518,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_01_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -551,7 +541,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -565,7 +554,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -573,9 +562,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -594,7 +581,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -617,7 +604,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -740,7 +726,7 @@ async def set_legal_hold( :rtype: ~azure.mgmt.storage.v2021_01_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -775,7 +761,6 @@ async def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -789,7 +774,7 @@ async def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -899,7 +884,7 @@ async def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2021_01_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -934,7 +919,6 @@ async def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -948,7 +932,7 @@ async def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1087,7 +1071,7 @@ async def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1127,7 +1111,6 @@ async def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1144,7 +1127,7 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1187,7 +1170,7 @@ async def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1212,7 +1195,6 @@ async def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1229,7 +1211,7 @@ async def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1274,7 +1256,7 @@ async def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1299,7 +1281,6 @@ async def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1316,7 +1297,7 @@ async def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1350,7 +1331,7 @@ async def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1374,7 +1355,6 @@ async def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1391,7 +1371,7 @@ async def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1521,7 +1501,7 @@ async def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1560,7 +1540,6 @@ async def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1577,7 +1556,7 @@ async def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1687,7 +1666,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2021_01_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1725,7 +1704,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1739,7 +1717,7 @@ async def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_inventory_policies_operations.py index 0d3a6570ef86..79366bb7f594 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_inventory_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,7 +110,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -128,7 +124,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -232,7 +228,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -267,7 +263,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -282,7 +277,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -290,7 +285,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -314,7 +309,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -337,7 +332,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -379,7 +373,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -398,7 +392,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -414,7 +407,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_services_operations.py index 92ebf5702093..8859ee4afff1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_services_operations import ( build_get_service_properties_request, build_list_request, @@ -39,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +86,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -253,7 +248,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_01_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -288,7 +283,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -302,7 +296,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -330,7 +324,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_01_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,7 +347,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -367,7 +360,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_deleted_accounts_operations.py index 4b79d70c34e5..5fe11c845948 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,21 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_accounts_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DeletedAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +88,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -107,7 +103,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -149,7 +144,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> :rtype: ~azure.mgmt.storage.v2021_01_01.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +166,6 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -186,7 +180,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_encryption_scopes_operations.py index 83e11566a928..2eef70f21c8e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._encryption_scopes_operations import ( build_get_request, build_list_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -173,7 +170,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2021_01_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +205,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -223,11 +219,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +329,7 @@ async def patch( :rtype: ~azure.mgmt.storage.v2021_01_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +364,6 @@ async def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -387,7 +378,7 @@ async def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -416,7 +407,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_01_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -439,7 +430,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -454,7 +444,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -485,7 +475,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +494,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -520,7 +509,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_file_services_operations.py index b14be8b68930..8f21fab1a900 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2021_01_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -219,7 +215,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_01_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,7 +250,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -268,7 +263,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -296,7 +291,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_01_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -319,7 +314,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -333,7 +327,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_file_shares_operations.py index 96b5f9185265..3191d6c1e076 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_file_shares_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_shares_operations import ( build_create_request, build_delete_request, @@ -42,7 +39,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -106,7 +103,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -128,7 +125,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -144,7 +140,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -288,7 +283,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_01_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -324,7 +319,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -338,11 +332,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -452,7 +442,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_01_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -487,7 +477,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -501,7 +490,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -542,7 +531,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_01_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -567,7 +556,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -581,7 +569,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -589,7 +577,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -617,7 +605,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -641,7 +629,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -659,7 +646,7 @@ async def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -694,7 +681,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -729,7 +716,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -757,7 +744,7 @@ async def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -792,7 +779,6 @@ async def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_management_policies_operations.py index b2326511f0e5..22936519418f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._management_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +119,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -227,7 +223,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -262,7 +258,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -276,7 +271,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -284,7 +279,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -308,7 +303,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +326,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_object_replication_policies_operations.py index f946224b2c85..04ef2eb5e65b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._object_replication_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -175,7 +170,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -198,7 +193,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -213,7 +207,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -317,7 +311,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -352,7 +346,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -367,7 +360,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -375,7 +368,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, object_replication_policy_id: str, **kwargs: Any ) -> None: """Deletes the object replication policy associated with the specified storage account. @@ -394,7 +387,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -417,7 +410,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_operations.py index af976c478c72..c285a87575be 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_private_endpoint_connections_operations.py index eb743576ec5e..7c56b63f8078 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connections_operations import ( build_delete_request, build_get_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -174,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_01_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -197,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -212,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -313,7 +307,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2021_01_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +342,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -363,7 +356,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -371,7 +364,7 @@ async def put( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: """Deletes the specified private endpoint connection associated with the storage account. @@ -390,7 +383,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -413,7 +406,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_private_link_resources_operations.py index fa1888354890..9e3199de8c17 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_by_storage_account_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ async def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2021_01_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,7 +92,6 @@ async def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +105,7 @@ async def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_queue_operations.py index 568bae7a5151..d2dda8b1ea17 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_operations import ( build_create_request, build_delete_request, @@ -41,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -166,7 +163,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_01_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -322,7 +318,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_01_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -357,7 +353,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -371,7 +366,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -400,7 +395,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_01_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +418,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -437,7 +431,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -445,9 +439,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any) -> None: """Deletes the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -466,7 +458,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -489,7 +481,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -541,7 +532,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -562,7 +553,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -578,7 +568,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_queue_services_operations.py index c4c9410c7179..787e432bdf3d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2021_01_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -219,7 +215,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_01_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,7 +250,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -268,7 +263,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -296,7 +291,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_01_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -319,7 +314,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -333,7 +327,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_skus_operations.py index 2a5b63c43d71..1eaafb7c7bc9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -90,7 +87,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -106,7 +102,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_storage_accounts_operations.py index 3bf028862a44..882137af2eea 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_check_name_availability_request, build_create_request, @@ -52,7 +65,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -135,7 +148,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2021_01_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -167,7 +180,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -181,7 +193,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -194,8 +206,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +220,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -229,10 +241,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -240,12 +252,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -371,10 +385,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -397,9 +412,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -413,7 +426,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -435,7 +448,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -480,7 +492,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2021_01_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -503,7 +515,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -517,7 +528,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -628,7 +639,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_01_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -662,7 +673,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -676,7 +686,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -699,7 +709,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -716,7 +726,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -732,7 +741,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -782,7 +790,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -800,7 +808,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -816,7 +823,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -866,7 +872,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2021_01_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -889,7 +895,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -903,7 +908,7 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -997,7 +1002,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2021_01_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1031,7 +1036,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1045,7 +1049,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1136,7 +1140,7 @@ async def list_account_sas( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1170,7 +1174,6 @@ async def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1184,7 +1187,7 @@ async def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1273,7 +1276,7 @@ async def list_service_sas( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1307,7 +1310,6 @@ async def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1321,17 +1323,17 @@ async def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _failover_initial( # pylint: disable=inconsistent-return-statements + async def _failover_initial( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1343,7 +1345,7 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1353,10 +1355,10 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1364,11 +1366,19 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1396,7 +1406,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._failover_initial( # type: ignore + raw_result = await self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1405,6 +1415,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1434,8 +1445,8 @@ async def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1448,7 +1459,7 @@ async def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1469,10 +1480,10 @@ async def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1480,14 +1491,14 @@ async def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1603,10 +1614,11 @@ async def begin_restore_blob_ranges( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1631,9 +1643,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def revoke_user_delegation_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1647,7 +1657,7 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1669,7 +1679,6 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_table_operations.py index 83734d9e3f62..346a1fed2f7f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_operations import ( build_create_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_01_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +119,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -151,7 +147,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_01_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -174,7 +170,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -188,7 +183,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -214,7 +209,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str :rtype: ~azure.mgmt.storage.v2021_01_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -237,7 +232,6 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -251,7 +245,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -259,9 +253,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any) -> None: """Deletes the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -279,7 +271,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -302,7 +294,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -340,7 +331,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -359,7 +350,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -375,7 +365,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_table_services_operations.py index 78c6d52dee4c..acfafe799084 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2021_01_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -219,7 +215,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_01_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,7 +250,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -268,7 +263,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -296,7 +291,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_01_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -319,7 +314,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -333,7 +327,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_usages_operations.py index 0edd3411a409..f166ceba4b30 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/aio/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usages_operations import build_list_by_location_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +72,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_mode api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -109,7 +105,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/__init__.py index d9bfdc0c6101..82e6b85e15b8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/__init__.py @@ -5,192 +5,203 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccountSasParameters -from ._models_py3 import ActiveDirectoryProperties -from ._models_py3 import AzureEntityResource -from ._models_py3 import AzureFilesIdentityBasedAuthentication -from ._models_py3 import BlobContainer -from ._models_py3 import BlobInventoryPolicy -from ._models_py3 import BlobInventoryPolicyDefinition -from ._models_py3 import BlobInventoryPolicyFilter -from ._models_py3 import BlobInventoryPolicyRule -from ._models_py3 import BlobInventoryPolicySchema -from ._models_py3 import BlobRestoreParameters -from ._models_py3 import BlobRestoreRange -from ._models_py3 import BlobRestoreStatus -from ._models_py3 import BlobServiceItems -from ._models_py3 import BlobServiceProperties -from ._models_py3 import ChangeFeed -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CloudErrorBody -from ._models_py3 import CorsRule -from ._models_py3 import CorsRules -from ._models_py3 import CustomDomain -from ._models_py3 import DateAfterCreation -from ._models_py3 import DateAfterModification -from ._models_py3 import DeleteRetentionPolicy -from ._models_py3 import DeletedAccount -from ._models_py3 import DeletedAccountListResult -from ._models_py3 import DeletedShare -from ._models_py3 import Dimension -from ._models_py3 import Encryption -from ._models_py3 import EncryptionIdentity -from ._models_py3 import EncryptionScope -from ._models_py3 import EncryptionScopeKeyVaultProperties -from ._models_py3 import EncryptionScopeListResult -from ._models_py3 import EncryptionService -from ._models_py3 import EncryptionServices -from ._models_py3 import Endpoints -from ._models_py3 import ErrorResponse -from ._models_py3 import ErrorResponseBody -from ._models_py3 import ExtendedLocation -from ._models_py3 import FileServiceItems -from ._models_py3 import FileServiceProperties -from ._models_py3 import FileShare -from ._models_py3 import FileShareItem -from ._models_py3 import FileShareItems -from ._models_py3 import GeoReplicationStats -from ._models_py3 import IPRule -from ._models_py3 import Identity -from ._models_py3 import ImmutabilityPolicy -from ._models_py3 import ImmutabilityPolicyProperties -from ._models_py3 import KeyVaultProperties -from ._models_py3 import LastAccessTimeTrackingPolicy -from ._models_py3 import LeaseContainerRequest -from ._models_py3 import LeaseContainerResponse -from ._models_py3 import LegalHold -from ._models_py3 import LegalHoldProperties -from ._models_py3 import ListAccountSasResponse -from ._models_py3 import ListBlobInventoryPolicy -from ._models_py3 import ListContainerItem -from ._models_py3 import ListContainerItems -from ._models_py3 import ListQueue -from ._models_py3 import ListQueueResource -from ._models_py3 import ListQueueServices -from ._models_py3 import ListServiceSasResponse -from ._models_py3 import ListTableResource -from ._models_py3 import ListTableServices -from ._models_py3 import ManagementPolicy -from ._models_py3 import ManagementPolicyAction -from ._models_py3 import ManagementPolicyBaseBlob -from ._models_py3 import ManagementPolicyDefinition -from ._models_py3 import ManagementPolicyFilter -from ._models_py3 import ManagementPolicyRule -from ._models_py3 import ManagementPolicySchema -from ._models_py3 import ManagementPolicySnapShot -from ._models_py3 import ManagementPolicyVersion -from ._models_py3 import MetricSpecification -from ._models_py3 import Multichannel -from ._models_py3 import NetworkRuleSet -from ._models_py3 import ObjectReplicationPolicies -from ._models_py3 import ObjectReplicationPolicy -from ._models_py3 import ObjectReplicationPolicyFilter -from ._models_py3 import ObjectReplicationPolicyRule -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import PrivateEndpoint -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionListResult -from ._models_py3 import PrivateLinkResource -from ._models_py3 import PrivateLinkResourceListResult -from ._models_py3 import PrivateLinkServiceConnectionState -from ._models_py3 import ProtocolSettings -from ._models_py3 import ProxyResource -from ._models_py3 import QueueServiceProperties -from ._models_py3 import Resource -from ._models_py3 import ResourceAccessRule -from ._models_py3 import RestorePolicyProperties -from ._models_py3 import Restriction -from ._models_py3 import RoutingPreference -from ._models_py3 import SKUCapability -from ._models_py3 import ServiceSasParameters -from ._models_py3 import ServiceSpecification -from ._models_py3 import Sku -from ._models_py3 import SkuInformation -from ._models_py3 import SmbSetting -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountInternetEndpoints -from ._models_py3 import StorageAccountKey -from ._models_py3 import StorageAccountListKeysResult -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountMicrosoftEndpoints -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import StorageQueue -from ._models_py3 import StorageSkuListResult -from ._models_py3 import SystemData -from ._models_py3 import Table -from ._models_py3 import TableServiceProperties -from ._models_py3 import TagFilter -from ._models_py3 import TagProperty -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateHistoryProperty -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName -from ._models_py3 import UserAssignedIdentity -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._storage_management_client_enums import AccessTier -from ._storage_management_client_enums import AccountStatus -from ._storage_management_client_enums import BlobInventoryPolicyName -from ._storage_management_client_enums import BlobRestoreProgressStatus -from ._storage_management_client_enums import Bypass -from ._storage_management_client_enums import CorsRuleAllowedMethodsItem -from ._storage_management_client_enums import CreatedByType -from ._storage_management_client_enums import DefaultAction -from ._storage_management_client_enums import DirectoryServiceOptions -from ._storage_management_client_enums import EnabledProtocols -from ._storage_management_client_enums import EncryptionScopeSource -from ._storage_management_client_enums import EncryptionScopeState -from ._storage_management_client_enums import Enum30 -from ._storage_management_client_enums import ExtendedLocationTypes -from ._storage_management_client_enums import GeoReplicationStatus -from ._storage_management_client_enums import HttpProtocol -from ._storage_management_client_enums import IdentityType -from ._storage_management_client_enums import ImmutabilityPolicyState -from ._storage_management_client_enums import ImmutabilityPolicyUpdateType -from ._storage_management_client_enums import InventoryRuleType -from ._storage_management_client_enums import KeyPermission -from ._storage_management_client_enums import KeySource -from ._storage_management_client_enums import KeyType -from ._storage_management_client_enums import Kind -from ._storage_management_client_enums import LargeFileSharesState -from ._storage_management_client_enums import LeaseContainerRequestAction -from ._storage_management_client_enums import LeaseDuration -from ._storage_management_client_enums import LeaseState -from ._storage_management_client_enums import LeaseStatus -from ._storage_management_client_enums import ListContainersInclude -from ._storage_management_client_enums import ListSharesExpand -from ._storage_management_client_enums import ManagementPolicyName -from ._storage_management_client_enums import MinimumTlsVersion -from ._storage_management_client_enums import Name -from ._storage_management_client_enums import Permissions -from ._storage_management_client_enums import PrivateEndpointConnectionProvisioningState -from ._storage_management_client_enums import PrivateEndpointServiceConnectionStatus -from ._storage_management_client_enums import ProvisioningState -from ._storage_management_client_enums import PublicAccess -from ._storage_management_client_enums import PutSharesExpand -from ._storage_management_client_enums import Reason -from ._storage_management_client_enums import ReasonCode -from ._storage_management_client_enums import RootSquashType -from ._storage_management_client_enums import RoutingChoice -from ._storage_management_client_enums import RuleType -from ._storage_management_client_enums import Services -from ._storage_management_client_enums import ShareAccessTier -from ._storage_management_client_enums import SignedResource -from ._storage_management_client_enums import SignedResourceTypes -from ._storage_management_client_enums import SkuName -from ._storage_management_client_enums import SkuTier -from ._storage_management_client_enums import State -from ._storage_management_client_enums import StorageAccountExpand -from ._storage_management_client_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccountSasParameters, + ActiveDirectoryProperties, + AzureEntityResource, + AzureFilesIdentityBasedAuthentication, + BlobContainer, + BlobInventoryPolicy, + BlobInventoryPolicyDefinition, + BlobInventoryPolicyFilter, + BlobInventoryPolicyRule, + BlobInventoryPolicySchema, + BlobRestoreParameters, + BlobRestoreRange, + BlobRestoreStatus, + BlobServiceItems, + BlobServiceProperties, + ChangeFeed, + CheckNameAvailabilityResult, + CloudErrorBody, + CorsRule, + CorsRules, + CustomDomain, + DateAfterCreation, + DateAfterModification, + DeleteRetentionPolicy, + DeletedAccount, + DeletedAccountListResult, + DeletedShare, + Dimension, + Encryption, + EncryptionIdentity, + EncryptionScope, + EncryptionScopeKeyVaultProperties, + EncryptionScopeListResult, + EncryptionService, + EncryptionServices, + Endpoints, + ErrorResponse, + ErrorResponseBody, + ExtendedLocation, + FileServiceItems, + FileServiceProperties, + FileShare, + FileShareItem, + FileShareItems, + GeoReplicationStats, + IPRule, + Identity, + ImmutabilityPolicy, + ImmutabilityPolicyProperties, + KeyVaultProperties, + LastAccessTimeTrackingPolicy, + LeaseContainerRequest, + LeaseContainerResponse, + LegalHold, + LegalHoldProperties, + ListAccountSasResponse, + ListBlobInventoryPolicy, + ListContainerItem, + ListContainerItems, + ListQueue, + ListQueueResource, + ListQueueServices, + ListServiceSasResponse, + ListTableResource, + ListTableServices, + ManagementPolicy, + ManagementPolicyAction, + ManagementPolicyBaseBlob, + ManagementPolicyDefinition, + ManagementPolicyFilter, + ManagementPolicyRule, + ManagementPolicySchema, + ManagementPolicySnapShot, + ManagementPolicyVersion, + MetricSpecification, + Multichannel, + NetworkRuleSet, + ObjectReplicationPolicies, + ObjectReplicationPolicy, + ObjectReplicationPolicyFilter, + ObjectReplicationPolicyRule, + Operation, + OperationDisplay, + OperationListResult, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionListResult, + PrivateLinkResource, + PrivateLinkResourceListResult, + PrivateLinkServiceConnectionState, + ProtocolSettings, + ProxyResource, + QueueServiceProperties, + Resource, + ResourceAccessRule, + RestorePolicyProperties, + Restriction, + RoutingPreference, + SKUCapability, + ServiceSasParameters, + ServiceSpecification, + Sku, + SkuInformation, + SmbSetting, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountInternetEndpoints, + StorageAccountKey, + StorageAccountListKeysResult, + StorageAccountListResult, + StorageAccountMicrosoftEndpoints, + StorageAccountRegenerateKeyParameters, + StorageAccountUpdateParameters, + StorageQueue, + StorageSkuListResult, + SystemData, + Table, + TableServiceProperties, + TagFilter, + TagProperty, + TrackedResource, + UpdateHistoryProperty, + Usage, + UsageListResult, + UsageName, + UserAssignedIdentity, + VirtualNetworkRule, +) + +from ._storage_management_client_enums import ( # type: ignore + AccessTier, + AccountStatus, + BlobInventoryPolicyName, + BlobRestoreProgressStatus, + Bypass, + CorsRuleAllowedMethodsItem, + CreatedByType, + DefaultAction, + DirectoryServiceOptions, + EnabledProtocols, + EncryptionScopeSource, + EncryptionScopeState, + Enum30, + ExtendedLocationTypes, + GeoReplicationStatus, + HttpProtocol, + IdentityType, + ImmutabilityPolicyState, + ImmutabilityPolicyUpdateType, + InventoryRuleType, + KeyPermission, + KeySource, + KeyType, + Kind, + LargeFileSharesState, + LeaseContainerRequestAction, + LeaseDuration, + LeaseState, + LeaseStatus, + ListContainersInclude, + ListSharesExpand, + ManagementPolicyName, + MinimumTlsVersion, + Name, + Permissions, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProvisioningState, + PublicAccess, + PutSharesExpand, + Reason, + ReasonCode, + RootSquashType, + RoutingChoice, + RuleType, + Services, + ShareAccessTier, + SignedResource, + SignedResourceTypes, + SkuName, + SkuTier, + State, + StorageAccountExpand, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -377,5 +388,5 @@ "StorageAccountExpand", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/_models_py3.py index c05583b8f84c..a50d7a3a981d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,7 +13,6 @@ from ... import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -309,7 +308,7 @@ def __init__( self.active_directory_properties = active_directory_properties -class BlobContainer(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class BlobContainer(AzureEntityResource): """Properties of the blob container, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -819,7 +818,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class BlobServiceProperties(Resource): # pylint: disable=too-many-instance-attributes +class BlobServiceProperties(Resource): """The properties of a storage account’s Blob service. Variables are only populated by the server, and will be ignored when sending a request. @@ -2063,7 +2062,7 @@ def __init__( self.protocol_settings = protocol_settings -class FileShare(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShare(AzureEntityResource): """Properties of the file share, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -2197,7 +2196,7 @@ def __init__( self.snapshot_time = None -class FileShareItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShareItem(AzureEntityResource): """The file share properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -2757,7 +2756,7 @@ class LeaseContainerRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2021_01_01.models.LeaseContainerRequestAction :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -2796,7 +2795,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2021_01_01.models.LeaseContainerRequestAction :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -2965,7 +2964,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class ListContainerItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class ListContainerItem(AzureEntityResource): """The blob container properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -4611,7 +4610,7 @@ def __init__( self.publish_internet_endpoints = publish_internet_endpoints -class ServiceSasParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ServiceSasParameters(_serialization.Model): """The parameters to list service SAS credentials of a specific resource. All required parameters must be populated in order to send to server. @@ -5057,7 +5056,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class StorageAccount(TrackedResource): # pylint: disable=too-many-instance-attributes +class StorageAccount(TrackedResource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. @@ -5363,7 +5362,7 @@ def __init__(self, *, name: str, **kwargs: Any) -> None: self.name = name -class StorageAccountCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountCreateParameters(_serialization.Model): """The parameters used when creating a storage account. All required parameters must be populated in order to send to server. @@ -5778,7 +5777,7 @@ def __init__(self, *, key_name: str, **kwargs: Any) -> None: self.key_name = key_name -class StorageAccountUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountUpdateParameters(_serialization.Model): """The parameters that can be provided when updating the storage account properties. :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/_storage_management_client_enums.py index d8de14ca8e0b..df99b9c4a414 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/_storage_management_client_enums.py @@ -230,6 +230,7 @@ class LeaseContainerRequestAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/__init__.py index 0f201012e160..d406c5bf4d6b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/__init__.py @@ -5,29 +5,35 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -51,5 +57,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_containers_operations.py index a9d36d83cf1a..1d44218b5da1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -613,7 +611,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -635,7 +633,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -651,7 +648,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -786,7 +782,7 @@ def create( :rtype: ~azure.mgmt.storage.v2021_01_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -821,7 +817,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -835,11 +830,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -949,7 +940,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_01_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -984,7 +975,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -998,7 +988,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1027,7 +1017,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_01_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1050,7 +1040,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1064,7 +1053,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1093,7 +1082,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1116,7 +1105,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1239,7 +1227,7 @@ def set_legal_hold( :rtype: ~azure.mgmt.storage.v2021_01_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1274,7 +1262,6 @@ def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1288,7 +1275,7 @@ def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1398,7 +1385,7 @@ def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2021_01_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1433,7 +1420,6 @@ def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1447,7 +1433,7 @@ def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1586,7 +1572,7 @@ def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1626,7 +1612,6 @@ def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1643,7 +1628,7 @@ def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1686,7 +1671,7 @@ def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1711,7 +1696,6 @@ def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1728,7 +1712,7 @@ def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1773,7 +1757,7 @@ def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1798,7 +1782,6 @@ def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1815,7 +1798,7 @@ def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1849,7 +1832,7 @@ def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1873,7 +1856,6 @@ def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1890,7 +1872,7 @@ def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2020,7 +2002,7 @@ def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2059,7 +2041,6 @@ def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2076,7 +2057,7 @@ def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2186,7 +2167,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2021_01_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2224,7 +2205,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2238,7 +2218,7 @@ def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_inventory_policies_operations.py index 37700c782cac..ed8a3c1c81fb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -235,7 +232,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +255,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -273,7 +269,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -377,7 +373,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2021_01_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -412,7 +408,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -427,7 +422,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -459,7 +454,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -482,7 +477,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -524,7 +518,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -543,7 +537,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -559,7 +552,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_services_operations.py index 5f9382900792..5c0aa6aa13fd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -197,7 +194,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -216,7 +213,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -232,7 +228,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -361,7 +356,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_01_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -396,7 +391,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -410,7 +404,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -438,7 +432,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_01_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -461,7 +455,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -475,7 +468,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_deleted_accounts_operations.py index 43ded3c2f253..f96e8affdf41 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -130,7 +127,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.DeletedAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -147,7 +144,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -163,7 +159,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -205,7 +200,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model :rtype: ~azure.mgmt.storage.v2021_01_01.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +222,6 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -242,7 +236,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_encryption_scopes_operations.py index d42dbf87a3ef..c3d69d24c531 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -315,7 +312,7 @@ def put( :rtype: ~azure.mgmt.storage.v2021_01_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -350,7 +347,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -365,11 +361,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -479,7 +471,7 @@ def patch( :rtype: ~azure.mgmt.storage.v2021_01_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -514,7 +506,6 @@ def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -529,7 +520,7 @@ def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -558,7 +549,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_01_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -581,7 +572,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -596,7 +586,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -624,7 +614,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -643,7 +633,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -659,7 +648,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_file_services_operations.py index 51e462a9630b..373cd552fa0b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2021_01_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +204,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -221,7 +217,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -328,7 +324,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_01_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -363,7 +359,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -377,7 +372,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -405,7 +400,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_01_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -428,7 +423,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -442,7 +436,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_file_shares_operations.py index 3123c5bc3980..562b28b39c84 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_file_shares_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -352,7 +350,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -374,7 +372,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -390,7 +387,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -534,7 +530,7 @@ def create( :rtype: ~azure.mgmt.storage.v2021_01_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -570,7 +566,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -584,11 +579,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -698,7 +689,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_01_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -733,7 +724,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -747,7 +737,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -788,7 +778,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_01_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -813,7 +803,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -827,7 +816,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -863,7 +852,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -887,7 +876,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -905,7 +893,7 @@ def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -940,7 +928,7 @@ def restore( # pylint: disable=inconsistent-return-statements """ @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -1003,7 +991,7 @@ def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1038,7 +1026,6 @@ def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_management_policies_operations.py index 36fbcc49df36..083c73181495 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -196,7 +193,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,7 +216,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -233,7 +229,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +333,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +368,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -386,7 +381,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -418,7 +413,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -441,7 +436,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_object_replication_policies_operations.py index ae1117ba832a..a0fa989091ef 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -229,7 +226,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -248,7 +245,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -264,7 +260,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -314,7 +309,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -337,7 +332,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -352,7 +346,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -456,7 +450,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -491,7 +485,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -506,7 +499,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -533,7 +526,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -556,7 +549,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_operations.py index 0e5554708307..2e6987a0d0eb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -126,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_private_endpoint_connections_operations.py index 584c4f597bef..fbb219521011 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -241,7 +238,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,7 +257,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -276,7 +272,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -325,7 +320,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_01_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +343,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -363,7 +357,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +458,7 @@ def put( :rtype: ~azure.mgmt.storage.v2021_01_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +493,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -514,7 +507,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -541,7 +534,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -564,7 +557,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_private_link_resources_operations.py index c9bf719d5e97..7e9a5ea1f692 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -109,7 +106,7 @@ def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2021_01_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -131,7 +128,6 @@ def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -145,7 +141,7 @@ def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_queue_operations.py index c55813666403..fb83fb205c5f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -375,7 +372,7 @@ def create( :rtype: ~azure.mgmt.storage.v2021_01_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -410,7 +407,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -424,7 +420,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -531,7 +527,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_01_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +562,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -580,7 +575,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -607,7 +602,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw :rtype: ~azure.mgmt.storage.v2021_01_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -630,7 +625,6 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -644,7 +638,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -673,7 +667,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -696,7 +690,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -747,7 +740,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -768,7 +761,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -784,7 +776,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_queue_services_operations.py index 2eb6cdf21048..0b9c3716f23f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2021_01_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +204,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -221,7 +217,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -328,7 +324,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_01_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -363,7 +359,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -377,7 +372,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -405,7 +400,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_01_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -428,7 +423,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -442,7 +436,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_skus_operations.py index f7d361dcb2e9..c222a593455d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_storage_accounts_operations.py index 8bc3da6703e6..dc2694e629eb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -582,7 +582,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2021_01_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -614,7 +614,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -628,7 +627,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -641,8 +640,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -655,7 +654,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -676,10 +675,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -687,12 +686,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -815,10 +816,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -857,7 +859,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -879,7 +881,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -924,7 +925,7 @@ def get_properties( :rtype: ~azure.mgmt.storage.v2021_01_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -947,7 +948,6 @@ def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -961,7 +961,7 @@ def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1072,7 +1072,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_01_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1106,7 +1106,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1120,7 +1119,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1142,7 +1141,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1159,7 +1158,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1175,7 +1173,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1222,7 +1219,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1240,7 +1237,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1256,7 +1252,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1306,7 +1301,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2021_01_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1329,7 +1324,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1343,7 +1337,7 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1437,7 +1431,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2021_01_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1471,7 +1465,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1485,7 +1478,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1576,7 +1569,7 @@ def list_account_sas( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1610,7 +1603,6 @@ def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1624,7 +1616,7 @@ def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1713,7 +1705,7 @@ def list_service_sas( :rtype: ~azure.mgmt.storage.v2021_01_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1747,7 +1739,6 @@ def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1761,17 +1752,15 @@ def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _failover_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _failover_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1783,7 +1772,7 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1793,10 +1782,10 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1804,11 +1793,19 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1836,7 +1833,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._failover_initial( # type: ignore + raw_result = self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1845,6 +1842,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1874,8 +1872,8 @@ def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1888,7 +1886,7 @@ def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1909,10 +1907,10 @@ def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1920,14 +1918,14 @@ def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2040,10 +2038,11 @@ def begin_restore_blob_ranges( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2084,7 +2083,7 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2106,7 +2105,6 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_table_operations.py index 958b2edaa6e7..85bed212ddd7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -255,7 +252,7 @@ def create(self, resource_group_name: str, account_name: str, table_name: str, * :rtype: ~azure.mgmt.storage.v2021_01_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -278,7 +275,6 @@ def create(self, resource_group_name: str, account_name: str, table_name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -292,7 +288,7 @@ def create(self, resource_group_name: str, account_name: str, table_name: str, * map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -318,7 +314,7 @@ def update(self, resource_group_name: str, account_name: str, table_name: str, * :rtype: ~azure.mgmt.storage.v2021_01_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -341,7 +337,6 @@ def update(self, resource_group_name: str, account_name: str, table_name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -355,7 +350,7 @@ def update(self, resource_group_name: str, account_name: str, table_name: str, * map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -381,7 +376,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw :rtype: ~azure.mgmt.storage.v2021_01_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -404,7 +399,6 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -418,7 +412,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -446,7 +440,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -469,7 +463,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -507,7 +500,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -526,7 +519,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -542,7 +534,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_table_services_operations.py index 978d7df9771e..dffc87384e4f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2021_01_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +204,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -221,7 +217,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -328,7 +324,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_01_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -363,7 +359,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -377,7 +372,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -405,7 +400,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_01_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -428,7 +423,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -442,7 +436,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_usages_operations.py index 7b96f58461df..c6edc83d5009 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -105,7 +102,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.Us api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -139,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/__init__.py index a860a5c185c9..60980065e1ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_configuration.py index 81bea65fe510..ec4aedaa5b19 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_metadata.json index 6cb872939b5a..21c0304058f5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_storage_management_client.py index dac901a8114c..bf476f1c991a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -40,11 +41,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -211,7 +211,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_version.py index 5a163c0afedc..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" \ No newline at end of file +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/__init__.py index a5c3d2414cfd..ee2b940bd4fc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/_configuration.py index d3591c932148..1df2ea6fb189 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/_storage_management_client.py index f1171f15d2f8..b044fa1f0490 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -40,11 +41,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -216,7 +216,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/__init__.py index 0f201012e160..d406c5bf4d6b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/__init__.py @@ -5,29 +5,35 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -51,5 +57,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_containers_operations.py index 56beba94f9e6..3d8031607160 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_containers_operations import ( build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, @@ -49,7 +47,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -114,7 +112,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -136,7 +134,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -152,7 +149,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -287,7 +283,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_02_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -322,7 +318,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -336,11 +331,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -450,7 +441,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_02_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -485,7 +476,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -499,7 +489,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -528,7 +518,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_02_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -551,7 +541,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -565,7 +554,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -573,9 +562,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -594,7 +581,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -617,7 +604,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -740,7 +726,7 @@ async def set_legal_hold( :rtype: ~azure.mgmt.storage.v2021_02_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -775,7 +761,6 @@ async def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -789,7 +774,7 @@ async def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -899,7 +884,7 @@ async def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2021_02_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -934,7 +919,6 @@ async def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -948,7 +932,7 @@ async def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1087,7 +1071,7 @@ async def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1127,7 +1111,6 @@ async def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1144,7 +1127,7 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1187,7 +1170,7 @@ async def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1212,7 +1195,6 @@ async def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1229,7 +1211,7 @@ async def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1274,7 +1256,7 @@ async def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1299,7 +1281,6 @@ async def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1316,7 +1297,7 @@ async def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1350,7 +1331,7 @@ async def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1374,7 +1355,6 @@ async def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1391,7 +1371,7 @@ async def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1521,7 +1501,7 @@ async def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1560,7 +1540,6 @@ async def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1577,7 +1556,7 @@ async def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1687,7 +1666,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2021_02_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1725,7 +1704,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1739,7 +1717,7 @@ async def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_inventory_policies_operations.py index c616681ecf49..21ad33ac873b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_inventory_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,7 +110,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -128,7 +124,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -232,7 +228,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -267,7 +263,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -282,7 +277,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -290,7 +285,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -314,7 +309,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -337,7 +332,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -379,7 +373,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -398,7 +392,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -414,7 +407,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_services_operations.py index 7eb0bf76f502..db0f11111607 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_services_operations import ( build_get_service_properties_request, build_list_request, @@ -39,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +86,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -253,7 +248,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_02_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -288,7 +283,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -302,7 +296,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -330,7 +324,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_02_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,7 +347,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -367,7 +360,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_deleted_accounts_operations.py index db12eda9dffe..faf54212caf6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,21 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_accounts_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DeletedAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +88,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -107,7 +103,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -149,7 +144,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> :rtype: ~azure.mgmt.storage.v2021_02_01.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +166,6 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -186,7 +180,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_encryption_scopes_operations.py index 77e97c3c6f7e..3730e2a50e34 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._encryption_scopes_operations import ( build_get_request, build_list_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -173,7 +170,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2021_02_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +205,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -223,11 +219,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +329,7 @@ async def patch( :rtype: ~azure.mgmt.storage.v2021_02_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +364,6 @@ async def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -387,7 +378,7 @@ async def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -416,7 +407,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_02_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -439,7 +430,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -454,7 +444,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -485,7 +475,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +494,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -520,7 +509,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_file_services_operations.py index 157848350567..6aee0d84cb40 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2021_02_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -219,7 +215,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_02_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,7 +250,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -268,7 +263,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -296,7 +291,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_02_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -319,7 +314,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -333,7 +327,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_file_shares_operations.py index 4e7c1bb00549..19e904572a24 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_file_shares_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_shares_operations import ( build_create_request, build_delete_request, @@ -42,7 +39,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -106,7 +103,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -128,7 +125,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -144,7 +140,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -288,7 +283,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_02_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -324,7 +319,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -338,11 +332,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -452,7 +442,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_02_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -487,7 +477,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -501,7 +490,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -542,7 +531,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_02_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -567,7 +556,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -581,7 +569,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -589,7 +577,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -617,7 +605,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -641,7 +629,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -659,7 +646,7 @@ async def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -694,7 +681,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -729,7 +716,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -757,7 +744,7 @@ async def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -792,7 +779,6 @@ async def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_management_policies_operations.py index 416b1abc4c15..e4181bc26840 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._management_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +119,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -227,7 +223,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -262,7 +258,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -276,7 +271,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -284,7 +279,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -308,7 +303,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +326,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_object_replication_policies_operations.py index 23f092418ebf..3648331fdfba 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._object_replication_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -175,7 +170,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -198,7 +193,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -213,7 +207,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -317,7 +311,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -352,7 +346,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -367,7 +360,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -375,7 +368,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, object_replication_policy_id: str, **kwargs: Any ) -> None: """Deletes the object replication policy associated with the specified storage account. @@ -394,7 +387,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -417,7 +410,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_operations.py index 30c64363bc2d..2848ba3abf02 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_private_endpoint_connections_operations.py index dbd72b159da8..15994dd7d444 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connections_operations import ( build_delete_request, build_get_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -174,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_02_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -197,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -212,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -313,7 +307,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2021_02_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +342,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -363,7 +356,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -371,7 +364,7 @@ async def put( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: """Deletes the specified private endpoint connection associated with the storage account. @@ -390,7 +383,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -413,7 +406,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_private_link_resources_operations.py index 7763354bb966..c4eb6dfbbb53 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_by_storage_account_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ async def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2021_02_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,7 +92,6 @@ async def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +105,7 @@ async def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_queue_operations.py index 4aab31d1795c..37699d8f0f41 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_operations import ( build_create_request, build_delete_request, @@ -41,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -166,7 +163,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_02_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -322,7 +318,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_02_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -357,7 +353,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -371,7 +366,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -400,7 +395,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_02_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +418,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -437,7 +431,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -445,9 +439,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any) -> None: """Deletes the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -466,7 +458,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -489,7 +481,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -541,7 +532,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -562,7 +553,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -578,7 +568,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_queue_services_operations.py index 2d7d416eea7b..ed74cee205b0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2021_02_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -219,7 +215,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_02_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,7 +250,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -268,7 +263,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -296,7 +291,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_02_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -319,7 +314,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -333,7 +327,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_skus_operations.py index 9b9056c0b91a..d0daac9ab5a5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -90,7 +87,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -106,7 +102,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_storage_accounts_operations.py index c9f73b49e41f..ec2e78d690da 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_check_name_availability_request, build_create_request, @@ -52,7 +65,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -135,7 +148,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2021_02_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -167,7 +180,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -181,7 +193,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -194,8 +206,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +220,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -229,10 +241,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -240,12 +252,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -371,10 +385,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -397,9 +412,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -413,7 +426,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -435,7 +448,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -480,7 +492,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2021_02_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -503,7 +515,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -517,7 +528,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -628,7 +639,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_02_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -662,7 +673,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -676,7 +686,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -699,7 +709,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -716,7 +726,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -732,7 +741,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -782,7 +790,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -800,7 +808,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -816,7 +823,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -866,7 +872,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2021_02_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -889,7 +895,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -903,7 +908,7 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -997,7 +1002,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2021_02_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1031,7 +1036,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1045,7 +1049,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1136,7 +1140,7 @@ async def list_account_sas( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1170,7 +1174,6 @@ async def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1184,7 +1187,7 @@ async def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1273,7 +1276,7 @@ async def list_service_sas( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1307,7 +1310,6 @@ async def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1321,17 +1323,17 @@ async def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _failover_initial( # pylint: disable=inconsistent-return-statements + async def _failover_initial( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1343,7 +1345,7 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1353,10 +1355,10 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1364,11 +1366,19 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1396,7 +1406,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._failover_initial( # type: ignore + raw_result = await self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1405,6 +1415,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1434,8 +1445,8 @@ async def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1448,7 +1459,7 @@ async def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1469,10 +1480,10 @@ async def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1480,14 +1491,14 @@ async def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1603,10 +1614,11 @@ async def begin_restore_blob_ranges( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1631,9 +1643,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def revoke_user_delegation_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1647,7 +1657,7 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1669,7 +1679,6 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_table_operations.py index 711d65a7ec89..1afc3b0be462 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_operations import ( build_create_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_02_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +119,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -151,7 +147,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_02_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -174,7 +170,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -188,7 +183,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -214,7 +209,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str :rtype: ~azure.mgmt.storage.v2021_02_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -237,7 +232,6 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -251,7 +245,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -259,9 +253,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any) -> None: """Deletes the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -279,7 +271,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -302,7 +294,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -340,7 +331,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -359,7 +350,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -375,7 +365,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_table_services_operations.py index 9bfce4a6109c..37137965d9bc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2021_02_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -219,7 +215,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_02_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,7 +250,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -268,7 +263,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -296,7 +291,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_02_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -319,7 +314,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -333,7 +327,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_usages_operations.py index ffd5e640defc..e27dded6811c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/aio/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usages_operations import build_list_by_location_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +72,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_mode api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -109,7 +105,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/__init__.py index c418076aa34b..96e5d90182a4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/__init__.py @@ -5,196 +5,207 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccountSasParameters -from ._models_py3 import ActiveDirectoryProperties -from ._models_py3 import AzureEntityResource -from ._models_py3 import AzureFilesIdentityBasedAuthentication -from ._models_py3 import BlobContainer -from ._models_py3 import BlobInventoryPolicy -from ._models_py3 import BlobInventoryPolicyDefinition -from ._models_py3 import BlobInventoryPolicyFilter -from ._models_py3 import BlobInventoryPolicyRule -from ._models_py3 import BlobInventoryPolicySchema -from ._models_py3 import BlobRestoreParameters -from ._models_py3 import BlobRestoreRange -from ._models_py3 import BlobRestoreStatus -from ._models_py3 import BlobServiceItems -from ._models_py3 import BlobServiceProperties -from ._models_py3 import ChangeFeed -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CloudErrorBody -from ._models_py3 import CorsRule -from ._models_py3 import CorsRules -from ._models_py3 import CustomDomain -from ._models_py3 import DateAfterCreation -from ._models_py3 import DateAfterModification -from ._models_py3 import DeleteRetentionPolicy -from ._models_py3 import DeletedAccount -from ._models_py3 import DeletedAccountListResult -from ._models_py3 import DeletedShare -from ._models_py3 import Dimension -from ._models_py3 import Encryption -from ._models_py3 import EncryptionIdentity -from ._models_py3 import EncryptionScope -from ._models_py3 import EncryptionScopeKeyVaultProperties -from ._models_py3 import EncryptionScopeListResult -from ._models_py3 import EncryptionService -from ._models_py3 import EncryptionServices -from ._models_py3 import Endpoints -from ._models_py3 import ErrorResponse -from ._models_py3 import ErrorResponseBody -from ._models_py3 import ExtendedLocation -from ._models_py3 import FileServiceItems -from ._models_py3 import FileServiceProperties -from ._models_py3 import FileShare -from ._models_py3 import FileShareItem -from ._models_py3 import FileShareItems -from ._models_py3 import GeoReplicationStats -from ._models_py3 import IPRule -from ._models_py3 import Identity -from ._models_py3 import ImmutabilityPolicy -from ._models_py3 import ImmutabilityPolicyProperties -from ._models_py3 import KeyCreationTime -from ._models_py3 import KeyPolicy -from ._models_py3 import KeyVaultProperties -from ._models_py3 import LastAccessTimeTrackingPolicy -from ._models_py3 import LeaseContainerRequest -from ._models_py3 import LeaseContainerResponse -from ._models_py3 import LegalHold -from ._models_py3 import LegalHoldProperties -from ._models_py3 import ListAccountSasResponse -from ._models_py3 import ListBlobInventoryPolicy -from ._models_py3 import ListContainerItem -from ._models_py3 import ListContainerItems -from ._models_py3 import ListQueue -from ._models_py3 import ListQueueResource -from ._models_py3 import ListQueueServices -from ._models_py3 import ListServiceSasResponse -from ._models_py3 import ListTableResource -from ._models_py3 import ListTableServices -from ._models_py3 import ManagementPolicy -from ._models_py3 import ManagementPolicyAction -from ._models_py3 import ManagementPolicyBaseBlob -from ._models_py3 import ManagementPolicyDefinition -from ._models_py3 import ManagementPolicyFilter -from ._models_py3 import ManagementPolicyRule -from ._models_py3 import ManagementPolicySchema -from ._models_py3 import ManagementPolicySnapShot -from ._models_py3 import ManagementPolicyVersion -from ._models_py3 import MetricSpecification -from ._models_py3 import Multichannel -from ._models_py3 import NetworkRuleSet -from ._models_py3 import ObjectReplicationPolicies -from ._models_py3 import ObjectReplicationPolicy -from ._models_py3 import ObjectReplicationPolicyFilter -from ._models_py3 import ObjectReplicationPolicyRule -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import PrivateEndpoint -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionListResult -from ._models_py3 import PrivateLinkResource -from ._models_py3 import PrivateLinkResourceListResult -from ._models_py3 import PrivateLinkServiceConnectionState -from ._models_py3 import ProtocolSettings -from ._models_py3 import ProxyResource -from ._models_py3 import QueueServiceProperties -from ._models_py3 import Resource -from ._models_py3 import ResourceAccessRule -from ._models_py3 import RestorePolicyProperties -from ._models_py3 import Restriction -from ._models_py3 import RoutingPreference -from ._models_py3 import SKUCapability -from ._models_py3 import SasPolicy -from ._models_py3 import ServiceSasParameters -from ._models_py3 import ServiceSpecification -from ._models_py3 import Sku -from ._models_py3 import SkuInformation -from ._models_py3 import SmbSetting -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountInternetEndpoints -from ._models_py3 import StorageAccountKey -from ._models_py3 import StorageAccountListKeysResult -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountMicrosoftEndpoints -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import StorageQueue -from ._models_py3 import StorageSkuListResult -from ._models_py3 import SystemData -from ._models_py3 import Table -from ._models_py3 import TableServiceProperties -from ._models_py3 import TagFilter -from ._models_py3 import TagProperty -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateHistoryProperty -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName -from ._models_py3 import UserAssignedIdentity -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._storage_management_client_enums import AccessTier -from ._storage_management_client_enums import AccountStatus -from ._storage_management_client_enums import BlobInventoryPolicyName -from ._storage_management_client_enums import BlobRestoreProgressStatus -from ._storage_management_client_enums import Bypass -from ._storage_management_client_enums import CorsRuleAllowedMethodsItem -from ._storage_management_client_enums import CreatedByType -from ._storage_management_client_enums import DefaultAction -from ._storage_management_client_enums import DirectoryServiceOptions -from ._storage_management_client_enums import EnabledProtocols -from ._storage_management_client_enums import EncryptionScopeSource -from ._storage_management_client_enums import EncryptionScopeState -from ._storage_management_client_enums import Enum31 -from ._storage_management_client_enums import ExpirationAction -from ._storage_management_client_enums import ExtendedLocationTypes -from ._storage_management_client_enums import GeoReplicationStatus -from ._storage_management_client_enums import HttpProtocol -from ._storage_management_client_enums import IdentityType -from ._storage_management_client_enums import ImmutabilityPolicyState -from ._storage_management_client_enums import ImmutabilityPolicyUpdateType -from ._storage_management_client_enums import InventoryRuleType -from ._storage_management_client_enums import KeyPermission -from ._storage_management_client_enums import KeySource -from ._storage_management_client_enums import KeyType -from ._storage_management_client_enums import Kind -from ._storage_management_client_enums import LargeFileSharesState -from ._storage_management_client_enums import LeaseContainerRequestAction -from ._storage_management_client_enums import LeaseDuration -from ._storage_management_client_enums import LeaseState -from ._storage_management_client_enums import LeaseStatus -from ._storage_management_client_enums import ListContainersInclude -from ._storage_management_client_enums import ListSharesExpand -from ._storage_management_client_enums import ManagementPolicyName -from ._storage_management_client_enums import MinimumTlsVersion -from ._storage_management_client_enums import Name -from ._storage_management_client_enums import Permissions -from ._storage_management_client_enums import PrivateEndpointConnectionProvisioningState -from ._storage_management_client_enums import PrivateEndpointServiceConnectionStatus -from ._storage_management_client_enums import ProvisioningState -from ._storage_management_client_enums import PublicAccess -from ._storage_management_client_enums import PutSharesExpand -from ._storage_management_client_enums import Reason -from ._storage_management_client_enums import ReasonCode -from ._storage_management_client_enums import RootSquashType -from ._storage_management_client_enums import RoutingChoice -from ._storage_management_client_enums import RuleType -from ._storage_management_client_enums import Services -from ._storage_management_client_enums import ShareAccessTier -from ._storage_management_client_enums import SignedResource -from ._storage_management_client_enums import SignedResourceTypes -from ._storage_management_client_enums import SkuName -from ._storage_management_client_enums import SkuTier -from ._storage_management_client_enums import State -from ._storage_management_client_enums import StorageAccountExpand -from ._storage_management_client_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccountSasParameters, + ActiveDirectoryProperties, + AzureEntityResource, + AzureFilesIdentityBasedAuthentication, + BlobContainer, + BlobInventoryPolicy, + BlobInventoryPolicyDefinition, + BlobInventoryPolicyFilter, + BlobInventoryPolicyRule, + BlobInventoryPolicySchema, + BlobRestoreParameters, + BlobRestoreRange, + BlobRestoreStatus, + BlobServiceItems, + BlobServiceProperties, + ChangeFeed, + CheckNameAvailabilityResult, + CloudErrorBody, + CorsRule, + CorsRules, + CustomDomain, + DateAfterCreation, + DateAfterModification, + DeleteRetentionPolicy, + DeletedAccount, + DeletedAccountListResult, + DeletedShare, + Dimension, + Encryption, + EncryptionIdentity, + EncryptionScope, + EncryptionScopeKeyVaultProperties, + EncryptionScopeListResult, + EncryptionService, + EncryptionServices, + Endpoints, + ErrorResponse, + ErrorResponseBody, + ExtendedLocation, + FileServiceItems, + FileServiceProperties, + FileShare, + FileShareItem, + FileShareItems, + GeoReplicationStats, + IPRule, + Identity, + ImmutabilityPolicy, + ImmutabilityPolicyProperties, + KeyCreationTime, + KeyPolicy, + KeyVaultProperties, + LastAccessTimeTrackingPolicy, + LeaseContainerRequest, + LeaseContainerResponse, + LegalHold, + LegalHoldProperties, + ListAccountSasResponse, + ListBlobInventoryPolicy, + ListContainerItem, + ListContainerItems, + ListQueue, + ListQueueResource, + ListQueueServices, + ListServiceSasResponse, + ListTableResource, + ListTableServices, + ManagementPolicy, + ManagementPolicyAction, + ManagementPolicyBaseBlob, + ManagementPolicyDefinition, + ManagementPolicyFilter, + ManagementPolicyRule, + ManagementPolicySchema, + ManagementPolicySnapShot, + ManagementPolicyVersion, + MetricSpecification, + Multichannel, + NetworkRuleSet, + ObjectReplicationPolicies, + ObjectReplicationPolicy, + ObjectReplicationPolicyFilter, + ObjectReplicationPolicyRule, + Operation, + OperationDisplay, + OperationListResult, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionListResult, + PrivateLinkResource, + PrivateLinkResourceListResult, + PrivateLinkServiceConnectionState, + ProtocolSettings, + ProxyResource, + QueueServiceProperties, + Resource, + ResourceAccessRule, + RestorePolicyProperties, + Restriction, + RoutingPreference, + SKUCapability, + SasPolicy, + ServiceSasParameters, + ServiceSpecification, + Sku, + SkuInformation, + SmbSetting, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountInternetEndpoints, + StorageAccountKey, + StorageAccountListKeysResult, + StorageAccountListResult, + StorageAccountMicrosoftEndpoints, + StorageAccountRegenerateKeyParameters, + StorageAccountUpdateParameters, + StorageQueue, + StorageSkuListResult, + SystemData, + Table, + TableServiceProperties, + TagFilter, + TagProperty, + TrackedResource, + UpdateHistoryProperty, + Usage, + UsageListResult, + UsageName, + UserAssignedIdentity, + VirtualNetworkRule, +) + +from ._storage_management_client_enums import ( # type: ignore + AccessTier, + AccountStatus, + BlobInventoryPolicyName, + BlobRestoreProgressStatus, + Bypass, + CorsRuleAllowedMethodsItem, + CreatedByType, + DefaultAction, + DirectoryServiceOptions, + EnabledProtocols, + EncryptionScopeSource, + EncryptionScopeState, + Enum31, + ExpirationAction, + ExtendedLocationTypes, + GeoReplicationStatus, + HttpProtocol, + IdentityType, + ImmutabilityPolicyState, + ImmutabilityPolicyUpdateType, + InventoryRuleType, + KeyPermission, + KeySource, + KeyType, + Kind, + LargeFileSharesState, + LeaseContainerRequestAction, + LeaseDuration, + LeaseState, + LeaseStatus, + ListContainersInclude, + ListSharesExpand, + ManagementPolicyName, + MinimumTlsVersion, + Name, + Permissions, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProvisioningState, + PublicAccess, + PutSharesExpand, + Reason, + ReasonCode, + RootSquashType, + RoutingChoice, + RuleType, + Services, + ShareAccessTier, + SignedResource, + SignedResourceTypes, + SkuName, + SkuTier, + State, + StorageAccountExpand, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -385,5 +396,5 @@ "StorageAccountExpand", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/_models_py3.py index 30a95af8e0ae..fe173ac44350 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,7 +13,6 @@ from ... import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -309,7 +308,7 @@ def __init__( self.active_directory_properties = active_directory_properties -class BlobContainer(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class BlobContainer(AzureEntityResource): """Properties of the blob container, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -819,7 +818,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class BlobServiceProperties(Resource): # pylint: disable=too-many-instance-attributes +class BlobServiceProperties(Resource): """The properties of a storage account’s Blob service. Variables are only populated by the server, and will be ignored when sending a request. @@ -2063,7 +2062,7 @@ def __init__( self.protocol_settings = protocol_settings -class FileShare(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShare(AzureEntityResource): """Properties of the file share, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -2197,7 +2196,7 @@ def __init__( self.snapshot_time = None -class FileShareItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShareItem(AzureEntityResource): """The file share properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -2811,7 +2810,7 @@ class LeaseContainerRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2021_02_01.models.LeaseContainerRequestAction :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -2850,7 +2849,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2021_02_01.models.LeaseContainerRequestAction :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -3019,7 +3018,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class ListContainerItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class ListContainerItem(AzureEntityResource): """The blob container properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -4704,7 +4703,7 @@ def __init__( self.expiration_action = expiration_action -class ServiceSasParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ServiceSasParameters(_serialization.Model): """The parameters to list service SAS credentials of a specific resource. All required parameters must be populated in order to send to server. @@ -5150,7 +5149,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class StorageAccount(TrackedResource): # pylint: disable=too-many-instance-attributes +class StorageAccount(TrackedResource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. @@ -5471,7 +5470,7 @@ def __init__(self, *, name: str, **kwargs: Any) -> None: self.name = name -class StorageAccountCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountCreateParameters(_serialization.Model): """The parameters used when creating a storage account. All required parameters must be populated in order to send to server. @@ -5905,7 +5904,7 @@ def __init__(self, *, key_name: str, **kwargs: Any) -> None: self.key_name = key_name -class StorageAccountUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountUpdateParameters(_serialization.Model): """The parameters that can be provided when updating the storage account properties. :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/_storage_management_client_enums.py index c8f6f588af5e..b8d266217924 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/_storage_management_client_enums.py @@ -236,6 +236,7 @@ class LeaseContainerRequestAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/__init__.py index 0f201012e160..d406c5bf4d6b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/__init__.py @@ -5,29 +5,35 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -51,5 +57,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_containers_operations.py index 4fea134b9ee6..982198e41a69 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -613,7 +611,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -635,7 +633,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -651,7 +648,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -786,7 +782,7 @@ def create( :rtype: ~azure.mgmt.storage.v2021_02_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -821,7 +817,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -835,11 +830,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -949,7 +940,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_02_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -984,7 +975,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -998,7 +988,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1027,7 +1017,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_02_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1050,7 +1040,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1064,7 +1053,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1093,7 +1082,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1116,7 +1105,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1239,7 +1227,7 @@ def set_legal_hold( :rtype: ~azure.mgmt.storage.v2021_02_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1274,7 +1262,6 @@ def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1288,7 +1275,7 @@ def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1398,7 +1385,7 @@ def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2021_02_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1433,7 +1420,6 @@ def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1447,7 +1433,7 @@ def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1586,7 +1572,7 @@ def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1626,7 +1612,6 @@ def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1643,7 +1628,7 @@ def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1686,7 +1671,7 @@ def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1711,7 +1696,6 @@ def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1728,7 +1712,7 @@ def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1773,7 +1757,7 @@ def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1798,7 +1782,6 @@ def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1815,7 +1798,7 @@ def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1849,7 +1832,7 @@ def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1873,7 +1856,6 @@ def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1890,7 +1872,7 @@ def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2020,7 +2002,7 @@ def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2059,7 +2041,6 @@ def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2076,7 +2057,7 @@ def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2186,7 +2167,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2021_02_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2224,7 +2205,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2238,7 +2218,7 @@ def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_inventory_policies_operations.py index 033ac8fd81c5..eaff2150c43a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -235,7 +232,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +255,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -273,7 +269,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -377,7 +373,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2021_02_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -412,7 +408,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -427,7 +422,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -459,7 +454,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -482,7 +477,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -524,7 +518,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -543,7 +537,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -559,7 +552,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_services_operations.py index df23d1b3ea8d..bfe1e7d192b9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -197,7 +194,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -216,7 +213,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -232,7 +228,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -361,7 +356,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_02_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -396,7 +391,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -410,7 +404,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -438,7 +432,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_02_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -461,7 +455,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -475,7 +468,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_deleted_accounts_operations.py index 2ca2bdd117ad..514910c26851 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -130,7 +127,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.DeletedAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -147,7 +144,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -163,7 +159,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -205,7 +200,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model :rtype: ~azure.mgmt.storage.v2021_02_01.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +222,6 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -242,7 +236,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_encryption_scopes_operations.py index bf0f1063eef3..0744c8bb1104 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -315,7 +312,7 @@ def put( :rtype: ~azure.mgmt.storage.v2021_02_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -350,7 +347,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -365,11 +361,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -479,7 +471,7 @@ def patch( :rtype: ~azure.mgmt.storage.v2021_02_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -514,7 +506,6 @@ def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -529,7 +520,7 @@ def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -558,7 +549,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_02_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -581,7 +572,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -596,7 +586,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -624,7 +614,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -643,7 +633,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -659,7 +648,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_file_services_operations.py index af65055c029b..46dde938b3da 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2021_02_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +204,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -221,7 +217,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -328,7 +324,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_02_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -363,7 +359,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -377,7 +372,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -405,7 +400,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_02_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -428,7 +423,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -442,7 +436,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_file_shares_operations.py index 4319a45c1ee3..94b87a4a8228 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_file_shares_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -352,7 +350,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -374,7 +372,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -390,7 +387,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -534,7 +530,7 @@ def create( :rtype: ~azure.mgmt.storage.v2021_02_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -570,7 +566,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -584,11 +579,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -698,7 +689,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_02_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -733,7 +724,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -747,7 +737,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -788,7 +778,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_02_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -813,7 +803,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -827,7 +816,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -863,7 +852,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -887,7 +876,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -905,7 +893,7 @@ def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -940,7 +928,7 @@ def restore( # pylint: disable=inconsistent-return-statements """ @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -1003,7 +991,7 @@ def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1038,7 +1026,6 @@ def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_management_policies_operations.py index b5bde8ded4de..55b54f5ff0b6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -196,7 +193,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,7 +216,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -233,7 +229,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +333,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +368,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -386,7 +381,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -418,7 +413,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -441,7 +436,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_object_replication_policies_operations.py index b3cf539bbbe1..5cc952564b9a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -229,7 +226,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -248,7 +245,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -264,7 +260,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -314,7 +309,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -337,7 +332,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -352,7 +346,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -456,7 +450,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -491,7 +485,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -506,7 +499,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -533,7 +526,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -556,7 +549,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_operations.py index ad0e815861c6..81eb2929a75b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -126,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_private_endpoint_connections_operations.py index bf0eecf41c46..3525cd388608 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -241,7 +238,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,7 +257,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -276,7 +272,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -325,7 +320,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_02_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +343,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -363,7 +357,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +458,7 @@ def put( :rtype: ~azure.mgmt.storage.v2021_02_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +493,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -514,7 +507,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -541,7 +534,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -564,7 +557,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_private_link_resources_operations.py index c994da87fe6d..9dfc72892cfb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -109,7 +106,7 @@ def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2021_02_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -131,7 +128,6 @@ def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -145,7 +141,7 @@ def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_queue_operations.py index af9cbd501961..9c5de07635e2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -375,7 +372,7 @@ def create( :rtype: ~azure.mgmt.storage.v2021_02_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -410,7 +407,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -424,7 +420,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -531,7 +527,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_02_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +562,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -580,7 +575,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -607,7 +602,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw :rtype: ~azure.mgmt.storage.v2021_02_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -630,7 +625,6 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -644,7 +638,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -673,7 +667,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -696,7 +690,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -747,7 +740,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -768,7 +761,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -784,7 +776,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_queue_services_operations.py index 8a599f5fe375..bf5b95c5428e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2021_02_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +204,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -221,7 +217,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -328,7 +324,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_02_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -363,7 +359,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -377,7 +372,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -405,7 +400,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_02_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -428,7 +423,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -442,7 +436,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_skus_operations.py index bb75cce90afb..5df9a683bb14 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_storage_accounts_operations.py index 8e0493052e4b..0eb76c326b52 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -582,7 +582,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2021_02_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -614,7 +614,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -628,7 +627,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -641,8 +640,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -655,7 +654,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -676,10 +675,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -687,12 +686,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -815,10 +816,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -857,7 +859,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -879,7 +881,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -924,7 +925,7 @@ def get_properties( :rtype: ~azure.mgmt.storage.v2021_02_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -947,7 +948,6 @@ def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -961,7 +961,7 @@ def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1072,7 +1072,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_02_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1106,7 +1106,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1120,7 +1119,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1142,7 +1141,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1159,7 +1158,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1175,7 +1173,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1222,7 +1219,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1240,7 +1237,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1256,7 +1252,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1306,7 +1301,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2021_02_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1329,7 +1324,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1343,7 +1337,7 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1437,7 +1431,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2021_02_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1471,7 +1465,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1485,7 +1478,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1576,7 +1569,7 @@ def list_account_sas( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1610,7 +1603,6 @@ def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1624,7 +1616,7 @@ def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1713,7 +1705,7 @@ def list_service_sas( :rtype: ~azure.mgmt.storage.v2021_02_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1747,7 +1739,6 @@ def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1761,17 +1752,15 @@ def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _failover_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _failover_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1783,7 +1772,7 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1793,10 +1782,10 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1804,11 +1793,19 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1836,7 +1833,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._failover_initial( # type: ignore + raw_result = self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1845,6 +1842,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1874,8 +1872,8 @@ def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1888,7 +1886,7 @@ def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1909,10 +1907,10 @@ def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1920,14 +1918,14 @@ def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2040,10 +2038,11 @@ def begin_restore_blob_ranges( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2084,7 +2083,7 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2106,7 +2105,6 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_table_operations.py index 4188a39cea35..d14b866b577a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -255,7 +252,7 @@ def create(self, resource_group_name: str, account_name: str, table_name: str, * :rtype: ~azure.mgmt.storage.v2021_02_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -278,7 +275,6 @@ def create(self, resource_group_name: str, account_name: str, table_name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -292,7 +288,7 @@ def create(self, resource_group_name: str, account_name: str, table_name: str, * map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -318,7 +314,7 @@ def update(self, resource_group_name: str, account_name: str, table_name: str, * :rtype: ~azure.mgmt.storage.v2021_02_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -341,7 +337,6 @@ def update(self, resource_group_name: str, account_name: str, table_name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -355,7 +350,7 @@ def update(self, resource_group_name: str, account_name: str, table_name: str, * map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -381,7 +376,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw :rtype: ~azure.mgmt.storage.v2021_02_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -404,7 +399,6 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -418,7 +412,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -446,7 +440,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -469,7 +463,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -507,7 +500,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -526,7 +519,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -542,7 +534,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_table_services_operations.py index 6e4f0daccbe9..2f97a6ba9cc9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2021_02_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +204,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -221,7 +217,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -328,7 +324,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_02_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -363,7 +359,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -377,7 +372,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -405,7 +400,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_02_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -428,7 +423,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -442,7 +436,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_usages_operations.py index 48091a67c8e3..f62b5fef4a05 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -105,7 +102,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.Us api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-02-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -139,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/__init__.py index a860a5c185c9..60980065e1ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_configuration.py index 03ebdfc441f4..80db472ca618 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_metadata.json index 7320234d7316..b247414835e4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_storage_management_client.py index 79386dd910fd..03394b7d1605 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -40,11 +41,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -211,7 +211,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_version.py index 5a163c0afedc..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" \ No newline at end of file +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/__init__.py index a5c3d2414cfd..ee2b940bd4fc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/_configuration.py index c5765ad05aae..96f8fc59c3d6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/_storage_management_client.py index 9b925d1c4783..42ac8a3a817e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -40,11 +41,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -216,7 +216,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/__init__.py index 0f201012e160..d406c5bf4d6b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/__init__.py @@ -5,29 +5,35 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -51,5 +57,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_containers_operations.py index 9c56fa59611e..ef00c7d3e73b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_containers_operations import ( build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, @@ -52,7 +52,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -117,7 +117,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -139,7 +139,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -155,7 +154,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -290,7 +288,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_04_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -325,7 +323,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -339,11 +336,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -453,7 +446,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_04_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -488,7 +481,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -502,7 +494,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -531,7 +523,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_04_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -554,7 +546,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -568,7 +559,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -576,9 +567,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -597,7 +586,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -620,7 +609,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -743,7 +731,7 @@ async def set_legal_hold( :rtype: ~azure.mgmt.storage.v2021_04_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -778,7 +766,6 @@ async def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -792,7 +779,7 @@ async def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -902,7 +889,7 @@ async def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2021_04_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -937,7 +924,6 @@ async def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -951,7 +937,7 @@ async def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1090,7 +1076,7 @@ async def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1130,7 +1116,6 @@ async def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1147,7 +1132,7 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1190,7 +1175,7 @@ async def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1215,7 +1200,6 @@ async def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1232,7 +1216,7 @@ async def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1277,7 +1261,7 @@ async def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1302,7 +1286,6 @@ async def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1319,7 +1302,7 @@ async def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1353,7 +1336,7 @@ async def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1377,7 +1360,6 @@ async def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1394,7 +1376,7 @@ async def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1524,7 +1506,7 @@ async def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1563,7 +1545,6 @@ async def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1580,7 +1561,7 @@ async def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1690,7 +1671,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2021_04_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1728,7 +1709,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1742,17 +1722,17 @@ async def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _object_level_worm_initial( # pylint: disable=inconsistent-return-statements + async def _object_level_worm_initial( self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1764,7 +1744,7 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_object_level_worm_request( resource_group_name=resource_group_name, @@ -1775,10 +1755,10 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1786,11 +1766,19 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_object_level_worm( @@ -1826,7 +1814,7 @@ async def begin_object_level_worm( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._object_level_worm_initial( # type: ignore + raw_result = await self._object_level_worm_initial( resource_group_name=resource_group_name, account_name=account_name, container_name=container_name, @@ -1836,6 +1824,7 @@ async def begin_object_level_worm( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_inventory_policies_operations.py index 0ea553b42740..33f35dbc2096 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_inventory_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,7 +110,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -128,7 +124,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -232,7 +228,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -267,7 +263,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -282,7 +277,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -290,7 +285,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -314,7 +309,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -337,7 +332,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -379,7 +373,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -398,7 +392,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -414,7 +407,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_services_operations.py index 50363f77bf92..7ab0ad642bb5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_services_operations import ( build_get_service_properties_request, build_list_request, @@ -39,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +86,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -253,7 +248,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_04_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -288,7 +283,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -302,7 +296,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -330,7 +324,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_04_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,7 +347,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -367,7 +360,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_deleted_accounts_operations.py index c2114db4e0d9..41939a369911 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,21 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_accounts_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DeletedAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +88,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -107,7 +103,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -149,7 +144,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> :rtype: ~azure.mgmt.storage.v2021_04_01.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +166,6 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -186,7 +180,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_encryption_scopes_operations.py index 11a48251eb0b..4f4a58f745bd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._encryption_scopes_operations import ( build_get_request, build_list_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -173,7 +170,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2021_04_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +205,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -223,11 +219,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +329,7 @@ async def patch( :rtype: ~azure.mgmt.storage.v2021_04_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +364,6 @@ async def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -387,7 +378,7 @@ async def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -416,7 +407,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_04_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -439,7 +430,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -454,7 +444,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -485,7 +475,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +494,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -520,7 +509,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_file_services_operations.py index 2f7e34171803..eb3344b39965 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2021_04_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -113,7 +109,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -220,7 +216,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_04_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -255,7 +251,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -270,7 +265,7 @@ async def set_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -298,7 +293,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_04_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -321,7 +316,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -336,7 +330,7 @@ async def get_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_file_shares_operations.py index 72f6609eb22a..16ed9a0c5be2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_file_shares_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_shares_operations import ( build_create_request, build_delete_request, @@ -43,7 +40,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -108,7 +105,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -130,7 +127,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -146,7 +142,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -294,7 +289,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_04_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -330,7 +325,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -345,11 +339,7 @@ async def create( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -459,7 +449,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_04_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -494,7 +484,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -509,7 +498,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -550,7 +539,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_04_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -575,7 +564,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -590,7 +578,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -598,7 +586,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -635,7 +623,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -660,7 +648,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -679,7 +666,7 @@ async def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -714,7 +701,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -749,7 +736,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -777,7 +764,7 @@ async def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -812,7 +799,6 @@ async def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -945,7 +931,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2021_04_01.models.LeaseShareResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -984,7 +970,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1002,7 +987,7 @@ async def lease( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("LeaseShareResponse", pipeline_response) + deserialized = self._deserialize("LeaseShareResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_management_policies_operations.py index 004fd58c4283..064210286a08 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._management_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +119,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -227,7 +223,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -262,7 +258,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -276,7 +271,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -284,7 +279,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -308,7 +303,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +326,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_object_replication_policies_operations.py index d26abe662500..7d5fccadb712 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._object_replication_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -177,7 +172,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -200,7 +195,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +209,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -325,7 +319,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -360,7 +354,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -375,7 +368,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -383,7 +376,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, object_replication_policy_id: str, **kwargs: Any ) -> None: """Deletes the object replication policy associated with the specified storage account. @@ -404,7 +397,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +420,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_operations.py index 5e24779407b4..40471cc034fd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_private_endpoint_connections_operations.py index 0aa67b410e62..ca6da68f5b12 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connections_operations import ( build_delete_request, build_get_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -174,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_04_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -197,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -212,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -313,7 +307,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2021_04_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +342,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -363,7 +356,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -371,7 +364,7 @@ async def put( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: """Deletes the specified private endpoint connection associated with the storage account. @@ -390,7 +383,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -413,7 +406,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_private_link_resources_operations.py index 581739b525b8..807f59c2dabc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_by_storage_account_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ async def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2021_04_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,7 +92,6 @@ async def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +105,7 @@ async def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_queue_operations.py index c65f7b356274..45673e3ebee1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_operations import ( build_create_request, build_delete_request, @@ -41,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -166,7 +163,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_04_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -216,7 +212,7 @@ async def create( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -323,7 +319,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_04_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -358,7 +354,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -373,7 +368,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -402,7 +397,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_04_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -425,7 +420,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -440,7 +434,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -448,9 +442,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any) -> None: """Deletes the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -469,7 +461,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -492,7 +484,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -545,7 +536,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +557,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -582,7 +572,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_queue_services_operations.py index fbdd93a3acba..25501959ea63 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2021_04_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -113,7 +109,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -220,7 +216,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_04_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -255,7 +251,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -270,7 +265,7 @@ async def set_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -298,7 +293,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_04_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -321,7 +316,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -336,7 +330,7 @@ async def get_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_skus_operations.py index 4dc0cc326178..88319083b680 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -90,7 +87,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -106,7 +102,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_storage_accounts_operations.py index 3e14cf8091b8..91e5573d8551 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_check_name_availability_request, build_create_request, @@ -52,7 +65,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -135,7 +148,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2021_04_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -167,7 +180,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -181,7 +193,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -194,8 +206,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +220,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -229,10 +241,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -240,12 +252,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -371,10 +385,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -397,9 +412,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -413,7 +426,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -435,7 +448,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -480,7 +492,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2021_04_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -503,7 +515,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -517,7 +528,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -628,7 +639,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_04_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -662,7 +673,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -676,7 +686,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -699,7 +709,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -716,7 +726,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -732,7 +741,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -782,7 +790,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -800,7 +808,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -816,7 +823,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -866,7 +872,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2021_04_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -889,7 +895,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -903,7 +908,7 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -997,7 +1002,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2021_04_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1031,7 +1036,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1045,7 +1049,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1136,7 +1140,7 @@ async def list_account_sas( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1170,7 +1174,6 @@ async def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1184,7 +1187,7 @@ async def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1273,7 +1276,7 @@ async def list_service_sas( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1307,7 +1310,6 @@ async def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1321,17 +1323,17 @@ async def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _failover_initial( # pylint: disable=inconsistent-return-statements + async def _failover_initial( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1343,7 +1345,7 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1353,10 +1355,10 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1364,11 +1366,19 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1396,7 +1406,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._failover_initial( # type: ignore + raw_result = await self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1405,6 +1415,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1434,8 +1445,8 @@ async def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1448,7 +1459,7 @@ async def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1469,10 +1480,10 @@ async def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1480,14 +1491,14 @@ async def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1603,10 +1614,11 @@ async def begin_restore_blob_ranges( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1631,9 +1643,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def revoke_user_delegation_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1647,7 +1657,7 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1669,7 +1679,6 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_table_operations.py index 8c70ea53523c..0bf7e27c0d4a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_operations import ( build_create_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_04_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -124,7 +120,7 @@ async def create( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -152,7 +148,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_04_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,7 +171,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -190,7 +185,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -216,7 +211,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str :rtype: ~azure.mgmt.storage.v2021_04_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -239,7 +234,6 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -254,7 +248,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -262,9 +256,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any) -> None: """Deletes the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -282,7 +274,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -305,7 +297,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -344,7 +335,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -363,7 +354,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -379,7 +369,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_table_services_operations.py index 049f361e72da..bbd7ce35bf9d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2021_04_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -113,7 +109,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -220,7 +216,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_04_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -255,7 +251,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -270,7 +265,7 @@ async def set_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -298,7 +293,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_04_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -321,7 +316,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -336,7 +330,7 @@ async def get_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_usages_operations.py index d0add84a4fef..baafdc5aeaf6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/aio/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usages_operations import build_list_by_location_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +72,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_mode api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -109,7 +105,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/__init__.py index e3653d567e9d..5ffd64373563 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/__init__.py @@ -5,207 +5,218 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccessPolicy -from ._models_py3 import AccountSasParameters -from ._models_py3 import ActiveDirectoryProperties -from ._models_py3 import AzureEntityResource -from ._models_py3 import AzureFilesIdentityBasedAuthentication -from ._models_py3 import BlobContainer -from ._models_py3 import BlobInventoryPolicy -from ._models_py3 import BlobInventoryPolicyDefinition -from ._models_py3 import BlobInventoryPolicyFilter -from ._models_py3 import BlobInventoryPolicyRule -from ._models_py3 import BlobInventoryPolicySchema -from ._models_py3 import BlobRestoreParameters -from ._models_py3 import BlobRestoreRange -from ._models_py3 import BlobRestoreStatus -from ._models_py3 import BlobServiceItems -from ._models_py3 import BlobServiceProperties -from ._models_py3 import ChangeFeed -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CloudErrorAutoGenerated -from ._models_py3 import CloudErrorBody -from ._models_py3 import CloudErrorBodyAutoGenerated -from ._models_py3 import CorsRule -from ._models_py3 import CorsRules -from ._models_py3 import CustomDomain -from ._models_py3 import DateAfterCreation -from ._models_py3 import DateAfterModification -from ._models_py3 import DeleteRetentionPolicy -from ._models_py3 import DeletedAccount -from ._models_py3 import DeletedAccountListResult -from ._models_py3 import DeletedShare -from ._models_py3 import Dimension -from ._models_py3 import Encryption -from ._models_py3 import EncryptionIdentity -from ._models_py3 import EncryptionScope -from ._models_py3 import EncryptionScopeKeyVaultProperties -from ._models_py3 import EncryptionScopeListResult -from ._models_py3 import EncryptionService -from ._models_py3 import EncryptionServices -from ._models_py3 import Endpoints -from ._models_py3 import ErrorResponse -from ._models_py3 import ErrorResponseBody -from ._models_py3 import ExtendedLocation -from ._models_py3 import FileServiceItems -from ._models_py3 import FileServiceProperties -from ._models_py3 import FileShare -from ._models_py3 import FileShareItem -from ._models_py3 import FileShareItems -from ._models_py3 import GeoReplicationStats -from ._models_py3 import IPRule -from ._models_py3 import Identity -from ._models_py3 import ImmutabilityPolicy -from ._models_py3 import ImmutabilityPolicyProperties -from ._models_py3 import ImmutableStorageWithVersioning -from ._models_py3 import KeyCreationTime -from ._models_py3 import KeyPolicy -from ._models_py3 import KeyVaultProperties -from ._models_py3 import LastAccessTimeTrackingPolicy -from ._models_py3 import LeaseContainerRequest -from ._models_py3 import LeaseContainerResponse -from ._models_py3 import LeaseShareRequest -from ._models_py3 import LeaseShareResponse -from ._models_py3 import LegalHold -from ._models_py3 import LegalHoldProperties -from ._models_py3 import ListAccountSasResponse -from ._models_py3 import ListBlobInventoryPolicy -from ._models_py3 import ListContainerItem -from ._models_py3 import ListContainerItems -from ._models_py3 import ListQueue -from ._models_py3 import ListQueueResource -from ._models_py3 import ListQueueServices -from ._models_py3 import ListServiceSasResponse -from ._models_py3 import ListTableResource -from ._models_py3 import ListTableServices -from ._models_py3 import ManagementPolicy -from ._models_py3 import ManagementPolicyAction -from ._models_py3 import ManagementPolicyBaseBlob -from ._models_py3 import ManagementPolicyDefinition -from ._models_py3 import ManagementPolicyFilter -from ._models_py3 import ManagementPolicyRule -from ._models_py3 import ManagementPolicySchema -from ._models_py3 import ManagementPolicySnapShot -from ._models_py3 import ManagementPolicyVersion -from ._models_py3 import MetricSpecification -from ._models_py3 import Multichannel -from ._models_py3 import NetworkRuleSet -from ._models_py3 import ObjectReplicationPolicies -from ._models_py3 import ObjectReplicationPolicy -from ._models_py3 import ObjectReplicationPolicyFilter -from ._models_py3 import ObjectReplicationPolicyRule -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import PrivateEndpoint -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionListResult -from ._models_py3 import PrivateLinkResource -from ._models_py3 import PrivateLinkResourceListResult -from ._models_py3 import PrivateLinkServiceConnectionState -from ._models_py3 import ProtocolSettings -from ._models_py3 import ProxyResource -from ._models_py3 import QueueServiceProperties -from ._models_py3 import Resource -from ._models_py3 import ResourceAccessRule -from ._models_py3 import RestorePolicyProperties -from ._models_py3 import Restriction -from ._models_py3 import RoutingPreference -from ._models_py3 import SKUCapability -from ._models_py3 import SasPolicy -from ._models_py3 import ServiceSasParameters -from ._models_py3 import ServiceSpecification -from ._models_py3 import SignedIdentifier -from ._models_py3 import Sku -from ._models_py3 import SkuInformation -from ._models_py3 import SmbSetting -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountInternetEndpoints -from ._models_py3 import StorageAccountKey -from ._models_py3 import StorageAccountListKeysResult -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountMicrosoftEndpoints -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import StorageQueue -from ._models_py3 import StorageSkuListResult -from ._models_py3 import SystemData -from ._models_py3 import Table -from ._models_py3 import TableServiceProperties -from ._models_py3 import TagFilter -from ._models_py3 import TagProperty -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateHistoryProperty -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName -from ._models_py3 import UserAssignedIdentity -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._storage_management_client_enums import AccessTier -from ._storage_management_client_enums import AccountStatus -from ._storage_management_client_enums import BlobInventoryPolicyName -from ._storage_management_client_enums import BlobRestoreProgressStatus -from ._storage_management_client_enums import Bypass -from ._storage_management_client_enums import CorsRuleAllowedMethodsItem -from ._storage_management_client_enums import CreatedByType -from ._storage_management_client_enums import DefaultAction -from ._storage_management_client_enums import DefaultSharePermission -from ._storage_management_client_enums import DirectoryServiceOptions -from ._storage_management_client_enums import EnabledProtocols -from ._storage_management_client_enums import EncryptionScopeSource -from ._storage_management_client_enums import EncryptionScopeState -from ._storage_management_client_enums import Enum35 -from ._storage_management_client_enums import ExpirationAction -from ._storage_management_client_enums import ExtendedLocationTypes -from ._storage_management_client_enums import Format -from ._storage_management_client_enums import GeoReplicationStatus -from ._storage_management_client_enums import HttpProtocol -from ._storage_management_client_enums import IdentityType -from ._storage_management_client_enums import ImmutabilityPolicyState -from ._storage_management_client_enums import ImmutabilityPolicyUpdateType -from ._storage_management_client_enums import InventoryRuleType -from ._storage_management_client_enums import KeyPermission -from ._storage_management_client_enums import KeySource -from ._storage_management_client_enums import KeyType -from ._storage_management_client_enums import Kind -from ._storage_management_client_enums import LargeFileSharesState -from ._storage_management_client_enums import LeaseContainerRequestAction -from ._storage_management_client_enums import LeaseDuration -from ._storage_management_client_enums import LeaseShareAction -from ._storage_management_client_enums import LeaseState -from ._storage_management_client_enums import LeaseStatus -from ._storage_management_client_enums import ListContainersInclude -from ._storage_management_client_enums import ManagementPolicyName -from ._storage_management_client_enums import MigrationState -from ._storage_management_client_enums import MinimumTlsVersion -from ._storage_management_client_enums import Name -from ._storage_management_client_enums import ObjectType -from ._storage_management_client_enums import Permissions -from ._storage_management_client_enums import PrivateEndpointConnectionProvisioningState -from ._storage_management_client_enums import PrivateEndpointServiceConnectionStatus -from ._storage_management_client_enums import ProvisioningState -from ._storage_management_client_enums import PublicAccess -from ._storage_management_client_enums import Reason -from ._storage_management_client_enums import ReasonCode -from ._storage_management_client_enums import RootSquashType -from ._storage_management_client_enums import RoutingChoice -from ._storage_management_client_enums import RuleType -from ._storage_management_client_enums import Schedule -from ._storage_management_client_enums import Services -from ._storage_management_client_enums import ShareAccessTier -from ._storage_management_client_enums import SignedResource -from ._storage_management_client_enums import SignedResourceTypes -from ._storage_management_client_enums import SkuName -from ._storage_management_client_enums import SkuTier -from ._storage_management_client_enums import State -from ._storage_management_client_enums import StorageAccountExpand -from ._storage_management_client_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccessPolicy, + AccountSasParameters, + ActiveDirectoryProperties, + AzureEntityResource, + AzureFilesIdentityBasedAuthentication, + BlobContainer, + BlobInventoryPolicy, + BlobInventoryPolicyDefinition, + BlobInventoryPolicyFilter, + BlobInventoryPolicyRule, + BlobInventoryPolicySchema, + BlobRestoreParameters, + BlobRestoreRange, + BlobRestoreStatus, + BlobServiceItems, + BlobServiceProperties, + ChangeFeed, + CheckNameAvailabilityResult, + CloudErrorAutoGenerated, + CloudErrorBody, + CloudErrorBodyAutoGenerated, + CorsRule, + CorsRules, + CustomDomain, + DateAfterCreation, + DateAfterModification, + DeleteRetentionPolicy, + DeletedAccount, + DeletedAccountListResult, + DeletedShare, + Dimension, + Encryption, + EncryptionIdentity, + EncryptionScope, + EncryptionScopeKeyVaultProperties, + EncryptionScopeListResult, + EncryptionService, + EncryptionServices, + Endpoints, + ErrorResponse, + ErrorResponseBody, + ExtendedLocation, + FileServiceItems, + FileServiceProperties, + FileShare, + FileShareItem, + FileShareItems, + GeoReplicationStats, + IPRule, + Identity, + ImmutabilityPolicy, + ImmutabilityPolicyProperties, + ImmutableStorageWithVersioning, + KeyCreationTime, + KeyPolicy, + KeyVaultProperties, + LastAccessTimeTrackingPolicy, + LeaseContainerRequest, + LeaseContainerResponse, + LeaseShareRequest, + LeaseShareResponse, + LegalHold, + LegalHoldProperties, + ListAccountSasResponse, + ListBlobInventoryPolicy, + ListContainerItem, + ListContainerItems, + ListQueue, + ListQueueResource, + ListQueueServices, + ListServiceSasResponse, + ListTableResource, + ListTableServices, + ManagementPolicy, + ManagementPolicyAction, + ManagementPolicyBaseBlob, + ManagementPolicyDefinition, + ManagementPolicyFilter, + ManagementPolicyRule, + ManagementPolicySchema, + ManagementPolicySnapShot, + ManagementPolicyVersion, + MetricSpecification, + Multichannel, + NetworkRuleSet, + ObjectReplicationPolicies, + ObjectReplicationPolicy, + ObjectReplicationPolicyFilter, + ObjectReplicationPolicyRule, + Operation, + OperationDisplay, + OperationListResult, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionListResult, + PrivateLinkResource, + PrivateLinkResourceListResult, + PrivateLinkServiceConnectionState, + ProtocolSettings, + ProxyResource, + QueueServiceProperties, + Resource, + ResourceAccessRule, + RestorePolicyProperties, + Restriction, + RoutingPreference, + SKUCapability, + SasPolicy, + ServiceSasParameters, + ServiceSpecification, + SignedIdentifier, + Sku, + SkuInformation, + SmbSetting, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountInternetEndpoints, + StorageAccountKey, + StorageAccountListKeysResult, + StorageAccountListResult, + StorageAccountMicrosoftEndpoints, + StorageAccountRegenerateKeyParameters, + StorageAccountUpdateParameters, + StorageQueue, + StorageSkuListResult, + SystemData, + Table, + TableServiceProperties, + TagFilter, + TagProperty, + TrackedResource, + UpdateHistoryProperty, + Usage, + UsageListResult, + UsageName, + UserAssignedIdentity, + VirtualNetworkRule, +) + +from ._storage_management_client_enums import ( # type: ignore + AccessTier, + AccountStatus, + BlobInventoryPolicyName, + BlobRestoreProgressStatus, + Bypass, + CorsRuleAllowedMethodsItem, + CreatedByType, + DefaultAction, + DefaultSharePermission, + DirectoryServiceOptions, + EnabledProtocols, + EncryptionScopeSource, + EncryptionScopeState, + Enum35, + ExpirationAction, + ExtendedLocationTypes, + Format, + GeoReplicationStatus, + HttpProtocol, + IdentityType, + ImmutabilityPolicyState, + ImmutabilityPolicyUpdateType, + InventoryRuleType, + KeyPermission, + KeySource, + KeyType, + Kind, + LargeFileSharesState, + LeaseContainerRequestAction, + LeaseDuration, + LeaseShareAction, + LeaseState, + LeaseStatus, + ListContainersInclude, + ManagementPolicyName, + MigrationState, + MinimumTlsVersion, + Name, + ObjectType, + Permissions, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProvisioningState, + PublicAccess, + Reason, + ReasonCode, + RootSquashType, + RoutingChoice, + RuleType, + Schedule, + Services, + ShareAccessTier, + SignedResource, + SignedResourceTypes, + SkuName, + SkuTier, + State, + StorageAccountExpand, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -407,5 +418,5 @@ "StorageAccountExpand", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/_models_py3.py index 3a8dd1e4ad41..fbb947aa2612 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,7 +13,6 @@ from ... import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -363,7 +362,7 @@ def __init__( self.default_share_permission = default_share_permission -class BlobContainer(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class BlobContainer(AzureEntityResource): """Properties of the blob container, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -962,7 +961,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class BlobServiceProperties(Resource): # pylint: disable=too-many-instance-attributes +class BlobServiceProperties(Resource): """The properties of a storage account’s Blob service. Variables are only populated by the server, and will be ignored when sending a request. @@ -2278,7 +2277,7 @@ def __init__( self.protocol_settings = protocol_settings -class FileShare(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShare(AzureEntityResource): """Properties of the file share, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -2436,7 +2435,7 @@ def __init__( self.snapshot_time = None -class FileShareItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShareItem(AzureEntityResource): """The file share properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -3112,7 +3111,7 @@ class LeaseContainerRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseContainerRequestAction :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -3151,7 +3150,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseContainerRequestAction :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -3209,7 +3208,7 @@ class LeaseShareRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseShareAction :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -3248,7 +3247,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2021_04_01.models.LeaseShareAction :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -3417,7 +3416,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class ListContainerItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class ListContainerItem(AzureEntityResource): """The blob container properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -5122,7 +5121,7 @@ def __init__( self.expiration_action = expiration_action -class ServiceSasParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ServiceSasParameters(_serialization.Model): """The parameters to list service SAS credentials of a specific resource. All required parameters must be populated in order to send to server. @@ -5600,7 +5599,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class StorageAccount(TrackedResource): # pylint: disable=too-many-instance-attributes +class StorageAccount(TrackedResource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. @@ -5930,7 +5929,7 @@ def __init__(self, *, name: str, **kwargs: Any) -> None: self.name = name -class StorageAccountCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountCreateParameters(_serialization.Model): """The parameters used when creating a storage account. All required parameters must be populated in order to send to server. @@ -6373,7 +6372,7 @@ def __init__(self, *, key_name: str, **kwargs: Any) -> None: self.key_name = key_name -class StorageAccountUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountUpdateParameters(_serialization.Model): """The parameters that can be provided when updating the storage account properties. :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/_storage_management_client_enums.py index 309f0b395d32..094c9006d1d1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/_storage_management_client_enums.py @@ -253,6 +253,7 @@ class LeaseContainerRequestAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" @@ -272,6 +273,7 @@ class LeaseShareAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/__init__.py index 0f201012e160..d406c5bf4d6b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/__init__.py @@ -5,29 +5,35 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -51,5 +57,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_containers_operations.py index 9c68296ffd8d..975e334dd33b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -649,7 +649,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -671,7 +671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -687,7 +686,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -822,7 +820,7 @@ def create( :rtype: ~azure.mgmt.storage.v2021_04_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -857,7 +855,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -871,11 +868,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -985,7 +978,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_04_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1020,7 +1013,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1034,7 +1026,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1063,7 +1055,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_04_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1086,7 +1078,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1100,7 +1091,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1129,7 +1120,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1152,7 +1143,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1275,7 +1265,7 @@ def set_legal_hold( :rtype: ~azure.mgmt.storage.v2021_04_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1310,7 +1300,6 @@ def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1324,7 +1313,7 @@ def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1434,7 +1423,7 @@ def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2021_04_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1469,7 +1458,6 @@ def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1483,7 +1471,7 @@ def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1622,7 +1610,7 @@ def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1662,7 +1650,6 @@ def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1679,7 +1666,7 @@ def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1722,7 +1709,7 @@ def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1747,7 +1734,6 @@ def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1764,7 +1750,7 @@ def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1809,7 +1795,7 @@ def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1834,7 +1820,6 @@ def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1851,7 +1836,7 @@ def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1885,7 +1870,7 @@ def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1909,7 +1894,6 @@ def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1926,7 +1910,7 @@ def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2056,7 +2040,7 @@ def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2095,7 +2079,6 @@ def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2112,7 +2095,7 @@ def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2222,7 +2205,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2021_04_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2260,7 +2243,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2274,17 +2256,17 @@ def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _object_level_worm_initial( # pylint: disable=inconsistent-return-statements + def _object_level_worm_initial( self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2296,7 +2278,7 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_object_level_worm_request( resource_group_name=resource_group_name, @@ -2307,10 +2289,10 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2318,11 +2300,19 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_object_level_worm( @@ -2358,7 +2348,7 @@ def begin_object_level_worm( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._object_level_worm_initial( # type: ignore + raw_result = self._object_level_worm_initial( resource_group_name=resource_group_name, account_name=account_name, container_name=container_name, @@ -2368,6 +2358,7 @@ def begin_object_level_worm( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_inventory_policies_operations.py index fe527ca86bfd..1cabbae98f1a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -235,7 +232,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +255,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -273,7 +269,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -377,7 +373,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2021_04_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -412,7 +408,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -427,7 +422,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -459,7 +454,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -482,7 +477,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -524,7 +518,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -543,7 +537,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -559,7 +552,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_services_operations.py index 20f4c8b363f6..3820f7a6d858 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -197,7 +194,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -216,7 +213,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -232,7 +228,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -361,7 +356,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_04_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -396,7 +391,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -410,7 +404,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -438,7 +432,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_04_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -461,7 +455,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -475,7 +468,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_deleted_accounts_operations.py index 605a7d468180..44b2780a42cc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -130,7 +127,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.DeletedAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -147,7 +144,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -163,7 +159,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -205,7 +200,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model :rtype: ~azure.mgmt.storage.v2021_04_01.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +222,6 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -242,7 +236,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_encryption_scopes_operations.py index f3db7f7ee940..11d1a3a7d990 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -315,7 +312,7 @@ def put( :rtype: ~azure.mgmt.storage.v2021_04_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -350,7 +347,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -365,11 +361,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -479,7 +471,7 @@ def patch( :rtype: ~azure.mgmt.storage.v2021_04_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -514,7 +506,6 @@ def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -529,7 +520,7 @@ def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -558,7 +549,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_04_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -581,7 +572,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -596,7 +586,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -624,7 +614,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -643,7 +633,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -659,7 +648,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_file_services_operations.py index dd7a2825356c..fd0a7eda9cfe 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2021_04_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +204,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -222,7 +218,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -329,7 +325,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_04_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -364,7 +360,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -379,7 +374,7 @@ def set_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -407,7 +402,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_04_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -430,7 +425,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -445,7 +439,7 @@ def get_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_file_shares_operations.py index 99420fb844a4..e2897c378ac5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_file_shares_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -401,7 +399,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +421,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -439,7 +436,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -587,7 +583,7 @@ def create( :rtype: ~azure.mgmt.storage.v2021_04_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -623,7 +619,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -638,11 +633,7 @@ def create( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -752,7 +743,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_04_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -787,7 +778,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -802,7 +792,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -843,7 +833,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_04_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -868,7 +858,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -883,7 +872,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -928,7 +917,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -953,7 +942,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -972,7 +960,7 @@ def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -1007,7 +995,7 @@ def restore( # pylint: disable=inconsistent-return-statements """ @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -1070,7 +1058,7 @@ def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1105,7 +1093,6 @@ def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1238,7 +1225,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2021_04_01.models.LeaseShareResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1277,7 +1264,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1295,7 +1281,7 @@ def lease( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("LeaseShareResponse", pipeline_response) + deserialized = self._deserialize("LeaseShareResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_management_policies_operations.py index df046ede1190..dd0dedd7ec84 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -196,7 +193,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,7 +216,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -233,7 +229,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +333,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +368,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -386,7 +381,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -418,7 +413,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -441,7 +436,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_object_replication_policies_operations.py index 311327d9fd46..7b72a487ef2a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -229,7 +226,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -248,7 +245,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -264,7 +260,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -316,7 +311,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -339,7 +334,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +348,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +458,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +493,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -514,7 +507,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -543,7 +536,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +559,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_operations.py index 38500019f335..638a1e27c50e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -126,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_private_endpoint_connections_operations.py index 81eac8d8e1d8..cae0cc802ef5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -241,7 +238,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,7 +257,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -276,7 +272,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -325,7 +320,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_04_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +343,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -363,7 +357,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +458,7 @@ def put( :rtype: ~azure.mgmt.storage.v2021_04_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +493,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -514,7 +507,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -541,7 +534,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -564,7 +557,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_private_link_resources_operations.py index 7d0ba74d13ea..e60bf19e5cc1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -109,7 +106,7 @@ def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2021_04_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -131,7 +128,6 @@ def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -145,7 +141,7 @@ def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_queue_operations.py index d0329c469f58..53187e18593d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -375,7 +372,7 @@ def create( :rtype: ~azure.mgmt.storage.v2021_04_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -410,7 +407,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -425,7 +421,7 @@ def create( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -532,7 +528,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_04_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -567,7 +563,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -582,7 +577,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -609,7 +604,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw :rtype: ~azure.mgmt.storage.v2021_04_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -632,7 +627,6 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -647,7 +641,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -676,7 +670,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -699,7 +693,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -751,7 +744,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -772,7 +765,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -788,7 +780,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_queue_services_operations.py index 40e2d5165bc1..2a6e9345608a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2021_04_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +204,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -222,7 +218,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -329,7 +325,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_04_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -364,7 +360,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -379,7 +374,7 @@ def set_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -407,7 +402,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_04_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -430,7 +425,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -445,7 +439,7 @@ def get_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_skus_operations.py index d1a8e845a31a..aa3cd129cd5c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_storage_accounts_operations.py index 8e61009e7a15..adbcaf0bbf58 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -582,7 +582,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2021_04_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -614,7 +614,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -628,7 +627,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -641,8 +640,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -655,7 +654,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -676,10 +675,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -687,12 +686,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -815,10 +816,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -857,7 +859,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -879,7 +881,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -924,7 +925,7 @@ def get_properties( :rtype: ~azure.mgmt.storage.v2021_04_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -947,7 +948,6 @@ def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -961,7 +961,7 @@ def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1072,7 +1072,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_04_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1106,7 +1106,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1120,7 +1119,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1142,7 +1141,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1159,7 +1158,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1175,7 +1173,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1222,7 +1219,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1240,7 +1237,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1256,7 +1252,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1306,7 +1301,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2021_04_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1329,7 +1324,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1343,7 +1337,7 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1437,7 +1431,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2021_04_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1471,7 +1465,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1485,7 +1478,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1576,7 +1569,7 @@ def list_account_sas( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1610,7 +1603,6 @@ def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1624,7 +1616,7 @@ def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1713,7 +1705,7 @@ def list_service_sas( :rtype: ~azure.mgmt.storage.v2021_04_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1747,7 +1739,6 @@ def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1761,17 +1752,15 @@ def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _failover_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _failover_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1783,7 +1772,7 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1793,10 +1782,10 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1804,11 +1793,19 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1836,7 +1833,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._failover_initial( # type: ignore + raw_result = self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1845,6 +1842,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1874,8 +1872,8 @@ def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1888,7 +1886,7 @@ def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1909,10 +1907,10 @@ def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1920,14 +1918,14 @@ def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2040,10 +2038,11 @@ def begin_restore_blob_ranges( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2084,7 +2083,7 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2106,7 +2105,6 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_table_operations.py index fe340b19e6eb..e8908a16393a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -255,7 +252,7 @@ def create(self, resource_group_name: str, account_name: str, table_name: str, * :rtype: ~azure.mgmt.storage.v2021_04_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -278,7 +275,6 @@ def create(self, resource_group_name: str, account_name: str, table_name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -293,7 +289,7 @@ def create(self, resource_group_name: str, account_name: str, table_name: str, * error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -319,7 +315,7 @@ def update(self, resource_group_name: str, account_name: str, table_name: str, * :rtype: ~azure.mgmt.storage.v2021_04_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -342,7 +338,6 @@ def update(self, resource_group_name: str, account_name: str, table_name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -357,7 +352,7 @@ def update(self, resource_group_name: str, account_name: str, table_name: str, * error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -383,7 +378,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw :rtype: ~azure.mgmt.storage.v2021_04_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -406,7 +401,6 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -421,7 +415,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -449,7 +443,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -472,7 +466,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -511,7 +504,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -530,7 +523,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -546,7 +538,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_table_services_operations.py index b94df1db7d41..ba59f3b9e9db 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2021_04_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +204,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -222,7 +218,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -329,7 +325,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_04_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -364,7 +360,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -379,7 +374,7 @@ def set_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -407,7 +402,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_04_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -430,7 +425,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -445,7 +439,7 @@ def get_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_usages_operations.py index f09a6eef31ea..bff537567688 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -105,7 +102,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.Us api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-04-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -139,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/__init__.py index a860a5c185c9..60980065e1ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_configuration.py index b6d027dc64f6..5d41dc363963 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_metadata.json index cdc805df4ea8..28d21a67e9ec 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_storage_management_client.py index b39d558d3e45..cb68553e33b1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -40,11 +41,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -211,7 +211,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_version.py index 5a163c0afedc..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" \ No newline at end of file +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/__init__.py index a5c3d2414cfd..ee2b940bd4fc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/_configuration.py index fa741b201cef..5ebc9640b03f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/_storage_management_client.py index bf308736b008..cdca57775870 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -40,11 +41,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -216,7 +216,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/__init__.py index 0f201012e160..d406c5bf4d6b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/__init__.py @@ -5,29 +5,35 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -51,5 +57,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_containers_operations.py index 7ab4691b7a23..10e84b3c00ca 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_containers_operations import ( build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, @@ -52,7 +65,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -117,7 +130,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -139,7 +152,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -155,7 +167,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -290,7 +301,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_06_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -325,7 +336,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -339,11 +349,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -453,7 +459,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_06_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -488,7 +494,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -502,7 +507,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -531,7 +536,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_06_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -554,7 +559,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -568,7 +572,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -576,9 +580,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -597,7 +599,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -620,7 +622,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -743,7 +744,7 @@ async def set_legal_hold( :rtype: ~azure.mgmt.storage.v2021_06_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -778,7 +779,6 @@ async def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -792,7 +792,7 @@ async def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -902,7 +902,7 @@ async def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2021_06_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -937,7 +937,6 @@ async def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -951,7 +950,7 @@ async def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1078,7 +1077,7 @@ async def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1119,7 +1118,6 @@ async def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1136,7 +1134,7 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1175,7 +1173,7 @@ async def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1201,7 +1199,6 @@ async def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1218,7 +1215,7 @@ async def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1254,7 +1251,7 @@ async def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1280,7 +1277,6 @@ async def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1297,7 +1293,7 @@ async def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1331,7 +1327,7 @@ async def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1355,7 +1351,6 @@ async def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1372,7 +1367,7 @@ async def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1502,7 +1497,7 @@ async def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1541,7 +1536,6 @@ async def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1558,7 +1552,7 @@ async def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1668,7 +1662,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2021_06_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1706,7 +1700,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1720,17 +1713,17 @@ async def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _object_level_worm_initial( # pylint: disable=inconsistent-return-statements + async def _object_level_worm_initial( self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1742,7 +1735,7 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_object_level_worm_request( resource_group_name=resource_group_name, @@ -1753,10 +1746,10 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1764,11 +1757,19 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_object_level_worm( @@ -1804,7 +1805,7 @@ async def begin_object_level_worm( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._object_level_worm_initial( # type: ignore + raw_result = await self._object_level_worm_initial( resource_group_name=resource_group_name, account_name=account_name, container_name=container_name, @@ -1814,6 +1815,7 @@ async def begin_object_level_worm( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_inventory_policies_operations.py index 643de8223d56..45cfaea3a5ae 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_inventory_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,7 +110,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -128,7 +124,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -232,7 +228,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -267,7 +263,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -282,7 +277,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -290,7 +285,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -314,7 +309,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -337,7 +332,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -379,7 +373,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -398,7 +392,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -414,7 +407,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_services_operations.py index fb23043de6e1..d41048a1ae89 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_services_operations import ( build_get_service_properties_request, build_list_request, @@ -39,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +86,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -241,7 +236,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_06_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -277,7 +272,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -291,7 +285,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -316,7 +310,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_06_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -340,7 +334,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +347,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_deleted_accounts_operations.py index 2c1c9c108721..43fce3790b81 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,21 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_accounts_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DeletedAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +88,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -107,7 +103,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -149,7 +144,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> :rtype: ~azure.mgmt.storage.v2021_06_01.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +166,6 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -186,7 +180,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_encryption_scopes_operations.py index edca3705f59d..a34d26ea65ec 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._encryption_scopes_operations import ( build_get_request, build_list_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -173,7 +170,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2021_06_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +205,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -223,11 +219,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +329,7 @@ async def patch( :rtype: ~azure.mgmt.storage.v2021_06_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +364,6 @@ async def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -387,7 +378,7 @@ async def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -416,7 +407,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_06_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -439,7 +430,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -454,7 +444,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -485,7 +475,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +494,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -520,7 +509,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_file_services_operations.py index 397fa8cbab87..8747d17acf3b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2021_06_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -113,7 +109,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -208,7 +204,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_06_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -244,7 +240,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -259,7 +254,7 @@ async def set_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -284,7 +279,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_06_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -308,7 +303,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -323,7 +317,7 @@ async def get_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_file_shares_operations.py index ea2d37444316..2a18bd37a56e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_file_shares_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_shares_operations import ( build_create_request, build_delete_request, @@ -43,7 +40,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -108,7 +105,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -130,7 +127,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -146,7 +142,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -294,7 +289,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_06_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -330,7 +325,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -345,11 +339,7 @@ async def create( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -459,7 +449,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_06_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -494,7 +484,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -509,7 +498,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -550,7 +539,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_06_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -575,7 +564,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -590,7 +578,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -598,7 +586,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -635,7 +623,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -660,7 +648,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -679,7 +666,7 @@ async def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -714,7 +701,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -749,7 +736,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -777,7 +764,7 @@ async def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -812,7 +799,6 @@ async def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -945,7 +931,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2021_06_01.models.LeaseShareResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -984,7 +970,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1002,7 +987,7 @@ async def lease( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("LeaseShareResponse", pipeline_response) + deserialized = self._deserialize("LeaseShareResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_management_policies_operations.py index c01f4c29e300..39a114ba1032 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._management_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +119,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -227,7 +223,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -262,7 +258,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -276,7 +271,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -284,7 +279,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -308,7 +303,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +326,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_object_replication_policies_operations.py index b9fda209fff7..77840a0d38a8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._object_replication_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -177,7 +172,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -200,7 +195,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +209,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -325,7 +319,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -360,7 +354,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -375,7 +368,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -383,7 +376,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, object_replication_policy_id: str, **kwargs: Any ) -> None: """Deletes the object replication policy associated with the specified storage account. @@ -404,7 +397,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +420,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_operations.py index b4b4862e0094..f40a6d6e2626 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_private_endpoint_connections_operations.py index 3cdaa2cbaaf0..f396e5312c78 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connections_operations import ( build_delete_request, build_get_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -174,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_06_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -197,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -212,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -313,7 +307,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2021_06_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +342,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -363,7 +356,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -371,7 +364,7 @@ async def put( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: """Deletes the specified private endpoint connection associated with the storage account. @@ -390,7 +383,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -413,7 +406,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_private_link_resources_operations.py index bce62b832177..631169b76212 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_by_storage_account_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ async def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2021_06_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,7 +92,6 @@ async def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +105,7 @@ async def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_queue_operations.py index 69882ae9043e..ed5d2b24fa4a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_operations import ( build_create_request, build_delete_request, @@ -41,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -166,7 +163,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_06_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -216,7 +212,7 @@ async def create( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -323,7 +319,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_06_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -358,7 +354,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -373,7 +368,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -402,7 +397,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_06_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -425,7 +420,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -440,7 +434,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -448,9 +442,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any) -> None: """Deletes the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -469,7 +461,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -492,7 +484,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -545,7 +536,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +557,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -582,7 +572,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_queue_services_operations.py index 7f8f0b75ee56..223e9242825b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2021_06_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -113,7 +109,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -208,7 +204,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_06_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -244,7 +240,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -259,7 +254,7 @@ async def set_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -284,7 +279,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_06_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -308,7 +303,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -323,7 +317,7 @@ async def get_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_skus_operations.py index 4047090dbedc..d2c92b595d1c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -90,7 +87,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -106,7 +102,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_storage_accounts_operations.py index d552d004e509..0b51a3e30dcd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_abort_hierarchical_namespace_migration_request, build_check_name_availability_request, @@ -54,7 +67,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -137,7 +150,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2021_06_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -169,7 +182,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -183,7 +195,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -196,8 +208,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -210,7 +222,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -231,10 +243,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -242,12 +254,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -373,10 +387,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -399,9 +414,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -415,7 +428,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -437,7 +450,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -482,7 +494,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2021_06_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -505,7 +517,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -519,7 +530,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -630,7 +641,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_06_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -664,7 +675,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -678,7 +688,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -701,7 +711,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -718,7 +728,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -734,7 +743,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -784,7 +792,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -802,7 +810,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -818,7 +825,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -868,7 +874,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2021_06_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -891,7 +897,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -905,7 +910,7 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -999,7 +1004,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2021_06_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1033,7 +1038,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1047,7 +1051,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1138,7 +1142,7 @@ async def list_account_sas( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1172,7 +1176,6 @@ async def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1186,7 +1189,7 @@ async def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1275,7 +1278,7 @@ async def list_service_sas( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1309,7 +1312,6 @@ async def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1323,17 +1325,17 @@ async def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _failover_initial( # pylint: disable=inconsistent-return-statements + async def _failover_initial( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1345,7 +1347,7 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1355,10 +1357,10 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1366,11 +1368,19 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1398,7 +1408,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._failover_initial( # type: ignore + raw_result = await self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1407,6 +1417,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1430,10 +1441,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, request_type: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1445,7 +1456,7 @@ async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -1456,10 +1467,10 @@ async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1467,12 +1478,20 @@ async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_hierarchical_namespace_migration( @@ -1505,7 +1524,7 @@ async def begin_hierarchical_namespace_migration( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._hierarchical_namespace_migration_initial( # type: ignore + raw_result = await self._hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, request_type=request_type, @@ -1515,6 +1534,7 @@ async def begin_hierarchical_namespace_migration( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1538,10 +1558,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1553,7 +1573,7 @@ async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=in _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_abort_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -1563,10 +1583,10 @@ async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=in headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1574,12 +1594,20 @@ async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-long @@ -1607,7 +1635,7 @@ async def begin_abort_hierarchical_namespace_migration( # pylint: disable=name- lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._abort_hierarchical_namespace_migration_initial( # type: ignore + raw_result = await self._abort_hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1616,6 +1644,7 @@ async def begin_abort_hierarchical_namespace_migration( # pylint: disable=name- params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1645,8 +1674,8 @@ async def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1659,7 +1688,7 @@ async def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1680,10 +1709,10 @@ async def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1691,14 +1720,14 @@ async def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1814,10 +1843,11 @@ async def begin_restore_blob_ranges( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1842,9 +1872,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def revoke_user_delegation_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1858,7 +1886,7 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1880,7 +1908,6 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_table_operations.py index 9297575e2060..1f637da5d07f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_operations import ( build_create_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_06_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -124,7 +120,7 @@ async def create( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -152,7 +148,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_06_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,7 +171,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -190,7 +185,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -216,7 +211,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str :rtype: ~azure.mgmt.storage.v2021_06_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -239,7 +234,6 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -254,7 +248,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -262,9 +256,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any) -> None: """Deletes the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -282,7 +274,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -305,7 +297,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -344,7 +335,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -363,7 +354,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -379,7 +369,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_table_services_operations.py index 7c0440eae2ac..aac2bf8c6df1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2021_06_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -113,7 +109,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -208,7 +204,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_06_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -244,7 +240,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -259,7 +254,7 @@ async def set_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -284,7 +279,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_06_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -308,7 +303,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -323,7 +317,7 @@ async def get_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_usages_operations.py index 4cd289671675..148cf246e810 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/aio/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usages_operations import build_list_by_location_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +72,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_mode api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -109,7 +105,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/__init__.py index 4c3f170090a0..72b49db0a0d0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/__init__.py @@ -5,211 +5,222 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccessPolicy -from ._models_py3 import AccountImmutabilityPolicyProperties -from ._models_py3 import AccountSasParameters -from ._models_py3 import ActiveDirectoryProperties -from ._models_py3 import AzureEntityResource -from ._models_py3 import AzureFilesIdentityBasedAuthentication -from ._models_py3 import BlobContainer -from ._models_py3 import BlobInventoryPolicy -from ._models_py3 import BlobInventoryPolicyDefinition -from ._models_py3 import BlobInventoryPolicyFilter -from ._models_py3 import BlobInventoryPolicyRule -from ._models_py3 import BlobInventoryPolicySchema -from ._models_py3 import BlobRestoreParameters -from ._models_py3 import BlobRestoreRange -from ._models_py3 import BlobRestoreStatus -from ._models_py3 import BlobServiceItems -from ._models_py3 import BlobServiceProperties -from ._models_py3 import ChangeFeed -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CloudErrorAutoGenerated -from ._models_py3 import CloudErrorBody -from ._models_py3 import CloudErrorBodyAutoGenerated -from ._models_py3 import CorsRule -from ._models_py3 import CorsRules -from ._models_py3 import CustomDomain -from ._models_py3 import DateAfterCreation -from ._models_py3 import DateAfterModification -from ._models_py3 import DeleteRetentionPolicy -from ._models_py3 import DeletedAccount -from ._models_py3 import DeletedAccountListResult -from ._models_py3 import DeletedShare -from ._models_py3 import Dimension -from ._models_py3 import Encryption -from ._models_py3 import EncryptionIdentity -from ._models_py3 import EncryptionScope -from ._models_py3 import EncryptionScopeKeyVaultProperties -from ._models_py3 import EncryptionScopeListResult -from ._models_py3 import EncryptionService -from ._models_py3 import EncryptionServices -from ._models_py3 import Endpoints -from ._models_py3 import ErrorResponse -from ._models_py3 import ErrorResponseBody -from ._models_py3 import ExtendedLocation -from ._models_py3 import FileServiceItems -from ._models_py3 import FileServiceProperties -from ._models_py3 import FileShare -from ._models_py3 import FileShareItem -from ._models_py3 import FileShareItems -from ._models_py3 import GeoReplicationStats -from ._models_py3 import IPRule -from ._models_py3 import Identity -from ._models_py3 import ImmutabilityPolicy -from ._models_py3 import ImmutabilityPolicyProperties -from ._models_py3 import ImmutableStorageAccount -from ._models_py3 import ImmutableStorageWithVersioning -from ._models_py3 import KeyCreationTime -from ._models_py3 import KeyPolicy -from ._models_py3 import KeyVaultProperties -from ._models_py3 import LastAccessTimeTrackingPolicy -from ._models_py3 import LeaseContainerRequest -from ._models_py3 import LeaseContainerResponse -from ._models_py3 import LeaseShareRequest -from ._models_py3 import LeaseShareResponse -from ._models_py3 import LegalHold -from ._models_py3 import LegalHoldProperties -from ._models_py3 import ListAccountSasResponse -from ._models_py3 import ListBlobInventoryPolicy -from ._models_py3 import ListContainerItem -from ._models_py3 import ListContainerItems -from ._models_py3 import ListQueue -from ._models_py3 import ListQueueResource -from ._models_py3 import ListQueueServices -from ._models_py3 import ListServiceSasResponse -from ._models_py3 import ListTableResource -from ._models_py3 import ListTableServices -from ._models_py3 import ManagementPolicy -from ._models_py3 import ManagementPolicyAction -from ._models_py3 import ManagementPolicyBaseBlob -from ._models_py3 import ManagementPolicyDefinition -from ._models_py3 import ManagementPolicyFilter -from ._models_py3 import ManagementPolicyRule -from ._models_py3 import ManagementPolicySchema -from ._models_py3 import ManagementPolicySnapShot -from ._models_py3 import ManagementPolicyVersion -from ._models_py3 import MetricSpecification -from ._models_py3 import Multichannel -from ._models_py3 import NetworkRuleSet -from ._models_py3 import ObjectReplicationPolicies -from ._models_py3 import ObjectReplicationPolicy -from ._models_py3 import ObjectReplicationPolicyFilter -from ._models_py3 import ObjectReplicationPolicyRule -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import PrivateEndpoint -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionListResult -from ._models_py3 import PrivateLinkResource -from ._models_py3 import PrivateLinkResourceListResult -from ._models_py3 import PrivateLinkServiceConnectionState -from ._models_py3 import ProtectedAppendWritesHistory -from ._models_py3 import ProtocolSettings -from ._models_py3 import ProxyResource -from ._models_py3 import QueueServiceProperties -from ._models_py3 import Resource -from ._models_py3 import ResourceAccessRule -from ._models_py3 import RestorePolicyProperties -from ._models_py3 import Restriction -from ._models_py3 import RoutingPreference -from ._models_py3 import SKUCapability -from ._models_py3 import SasPolicy -from ._models_py3 import ServiceSasParameters -from ._models_py3 import ServiceSpecification -from ._models_py3 import SignedIdentifier -from ._models_py3 import Sku -from ._models_py3 import SkuInformation -from ._models_py3 import SmbSetting -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountInternetEndpoints -from ._models_py3 import StorageAccountKey -from ._models_py3 import StorageAccountListKeysResult -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountMicrosoftEndpoints -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import StorageQueue -from ._models_py3 import StorageSkuListResult -from ._models_py3 import SystemData -from ._models_py3 import Table -from ._models_py3 import TableServiceProperties -from ._models_py3 import TagFilter -from ._models_py3 import TagProperty -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateHistoryProperty -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName -from ._models_py3 import UserAssignedIdentity -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._storage_management_client_enums import AccessTier -from ._storage_management_client_enums import AccountImmutabilityPolicyState -from ._storage_management_client_enums import AccountStatus -from ._storage_management_client_enums import BlobInventoryPolicyName -from ._storage_management_client_enums import BlobRestoreProgressStatus -from ._storage_management_client_enums import Bypass -from ._storage_management_client_enums import CorsRuleAllowedMethodsItem -from ._storage_management_client_enums import CreatedByType -from ._storage_management_client_enums import DefaultAction -from ._storage_management_client_enums import DefaultSharePermission -from ._storage_management_client_enums import DirectoryServiceOptions -from ._storage_management_client_enums import EnabledProtocols -from ._storage_management_client_enums import EncryptionScopeSource -from ._storage_management_client_enums import EncryptionScopeState -from ._storage_management_client_enums import ExpirationAction -from ._storage_management_client_enums import ExtendedLocationTypes -from ._storage_management_client_enums import Format -from ._storage_management_client_enums import GeoReplicationStatus -from ._storage_management_client_enums import HttpProtocol -from ._storage_management_client_enums import IdentityType -from ._storage_management_client_enums import ImmutabilityPolicyState -from ._storage_management_client_enums import ImmutabilityPolicyUpdateType -from ._storage_management_client_enums import InventoryRuleType -from ._storage_management_client_enums import KeyPermission -from ._storage_management_client_enums import KeySource -from ._storage_management_client_enums import KeyType -from ._storage_management_client_enums import Kind -from ._storage_management_client_enums import LargeFileSharesState -from ._storage_management_client_enums import LeaseContainerRequestAction -from ._storage_management_client_enums import LeaseDuration -from ._storage_management_client_enums import LeaseShareAction -from ._storage_management_client_enums import LeaseState -from ._storage_management_client_enums import LeaseStatus -from ._storage_management_client_enums import ListContainersInclude -from ._storage_management_client_enums import ManagementPolicyName -from ._storage_management_client_enums import MigrationState -from ._storage_management_client_enums import MinimumTlsVersion -from ._storage_management_client_enums import Name -from ._storage_management_client_enums import ObjectType -from ._storage_management_client_enums import Permissions -from ._storage_management_client_enums import PrivateEndpointConnectionProvisioningState -from ._storage_management_client_enums import PrivateEndpointServiceConnectionStatus -from ._storage_management_client_enums import ProvisioningState -from ._storage_management_client_enums import PublicAccess -from ._storage_management_client_enums import PublicNetworkAccess -from ._storage_management_client_enums import Reason -from ._storage_management_client_enums import ReasonCode -from ._storage_management_client_enums import RootSquashType -from ._storage_management_client_enums import RoutingChoice -from ._storage_management_client_enums import RuleType -from ._storage_management_client_enums import Schedule -from ._storage_management_client_enums import Services -from ._storage_management_client_enums import ShareAccessTier -from ._storage_management_client_enums import SignedResource -from ._storage_management_client_enums import SignedResourceTypes -from ._storage_management_client_enums import SkuName -from ._storage_management_client_enums import SkuTier -from ._storage_management_client_enums import State -from ._storage_management_client_enums import StorageAccountExpand -from ._storage_management_client_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccessPolicy, + AccountImmutabilityPolicyProperties, + AccountSasParameters, + ActiveDirectoryProperties, + AzureEntityResource, + AzureFilesIdentityBasedAuthentication, + BlobContainer, + BlobInventoryPolicy, + BlobInventoryPolicyDefinition, + BlobInventoryPolicyFilter, + BlobInventoryPolicyRule, + BlobInventoryPolicySchema, + BlobRestoreParameters, + BlobRestoreRange, + BlobRestoreStatus, + BlobServiceItems, + BlobServiceProperties, + ChangeFeed, + CheckNameAvailabilityResult, + CloudErrorAutoGenerated, + CloudErrorBody, + CloudErrorBodyAutoGenerated, + CorsRule, + CorsRules, + CustomDomain, + DateAfterCreation, + DateAfterModification, + DeleteRetentionPolicy, + DeletedAccount, + DeletedAccountListResult, + DeletedShare, + Dimension, + Encryption, + EncryptionIdentity, + EncryptionScope, + EncryptionScopeKeyVaultProperties, + EncryptionScopeListResult, + EncryptionService, + EncryptionServices, + Endpoints, + ErrorResponse, + ErrorResponseBody, + ExtendedLocation, + FileServiceItems, + FileServiceProperties, + FileShare, + FileShareItem, + FileShareItems, + GeoReplicationStats, + IPRule, + Identity, + ImmutabilityPolicy, + ImmutabilityPolicyProperties, + ImmutableStorageAccount, + ImmutableStorageWithVersioning, + KeyCreationTime, + KeyPolicy, + KeyVaultProperties, + LastAccessTimeTrackingPolicy, + LeaseContainerRequest, + LeaseContainerResponse, + LeaseShareRequest, + LeaseShareResponse, + LegalHold, + LegalHoldProperties, + ListAccountSasResponse, + ListBlobInventoryPolicy, + ListContainerItem, + ListContainerItems, + ListQueue, + ListQueueResource, + ListQueueServices, + ListServiceSasResponse, + ListTableResource, + ListTableServices, + ManagementPolicy, + ManagementPolicyAction, + ManagementPolicyBaseBlob, + ManagementPolicyDefinition, + ManagementPolicyFilter, + ManagementPolicyRule, + ManagementPolicySchema, + ManagementPolicySnapShot, + ManagementPolicyVersion, + MetricSpecification, + Multichannel, + NetworkRuleSet, + ObjectReplicationPolicies, + ObjectReplicationPolicy, + ObjectReplicationPolicyFilter, + ObjectReplicationPolicyRule, + Operation, + OperationDisplay, + OperationListResult, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionListResult, + PrivateLinkResource, + PrivateLinkResourceListResult, + PrivateLinkServiceConnectionState, + ProtectedAppendWritesHistory, + ProtocolSettings, + ProxyResource, + QueueServiceProperties, + Resource, + ResourceAccessRule, + RestorePolicyProperties, + Restriction, + RoutingPreference, + SKUCapability, + SasPolicy, + ServiceSasParameters, + ServiceSpecification, + SignedIdentifier, + Sku, + SkuInformation, + SmbSetting, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountInternetEndpoints, + StorageAccountKey, + StorageAccountListKeysResult, + StorageAccountListResult, + StorageAccountMicrosoftEndpoints, + StorageAccountRegenerateKeyParameters, + StorageAccountUpdateParameters, + StorageQueue, + StorageSkuListResult, + SystemData, + Table, + TableServiceProperties, + TagFilter, + TagProperty, + TrackedResource, + UpdateHistoryProperty, + Usage, + UsageListResult, + UsageName, + UserAssignedIdentity, + VirtualNetworkRule, +) + +from ._storage_management_client_enums import ( # type: ignore + AccessTier, + AccountImmutabilityPolicyState, + AccountStatus, + BlobInventoryPolicyName, + BlobRestoreProgressStatus, + Bypass, + CorsRuleAllowedMethodsItem, + CreatedByType, + DefaultAction, + DefaultSharePermission, + DirectoryServiceOptions, + EnabledProtocols, + EncryptionScopeSource, + EncryptionScopeState, + ExpirationAction, + ExtendedLocationTypes, + Format, + GeoReplicationStatus, + HttpProtocol, + IdentityType, + ImmutabilityPolicyState, + ImmutabilityPolicyUpdateType, + InventoryRuleType, + KeyPermission, + KeySource, + KeyType, + Kind, + LargeFileSharesState, + LeaseContainerRequestAction, + LeaseDuration, + LeaseShareAction, + LeaseState, + LeaseStatus, + ListContainersInclude, + ManagementPolicyName, + MigrationState, + MinimumTlsVersion, + Name, + ObjectType, + Permissions, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProvisioningState, + PublicAccess, + PublicNetworkAccess, + Reason, + ReasonCode, + RootSquashType, + RoutingChoice, + RuleType, + Schedule, + Services, + ShareAccessTier, + SignedResource, + SignedResourceTypes, + SkuName, + SkuTier, + State, + StorageAccountExpand, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -415,5 +426,5 @@ "StorageAccountExpand", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/_models_py3.py index 7e7427261fbb..bf58fb75a0fc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,7 +13,6 @@ from ... import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -426,7 +425,7 @@ def __init__( self.default_share_permission = default_share_permission -class BlobContainer(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class BlobContainer(AzureEntityResource): """Properties of the blob container, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -1039,7 +1038,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class BlobServiceProperties(Resource): # pylint: disable=too-many-instance-attributes +class BlobServiceProperties(Resource): """The properties of a storage account’s Blob service. Variables are only populated by the server, and will be ignored when sending a request. @@ -2355,7 +2354,7 @@ def __init__( self.protocol_settings = protocol_settings -class FileShare(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShare(AzureEntityResource): """Properties of the file share, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -2513,7 +2512,7 @@ def __init__( self.snapshot_time = None -class FileShareItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShareItem(AzureEntityResource): """The file share properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -3268,7 +3267,7 @@ class LeaseContainerRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseContainerRequestAction :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -3307,7 +3306,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseContainerRequestAction :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -3365,7 +3364,7 @@ class LeaseShareRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseShareAction :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -3404,7 +3403,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2021_06_01.models.LeaseShareAction :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -3602,7 +3601,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class ListContainerItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class ListContainerItem(AzureEntityResource): """The blob container properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -5355,7 +5354,7 @@ def __init__( self.expiration_action = expiration_action -class ServiceSasParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ServiceSasParameters(_serialization.Model): """The parameters to list service SAS credentials of a specific resource. All required parameters must be populated in order to send to server. @@ -5833,7 +5832,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class StorageAccount(TrackedResource): # pylint: disable=too-many-instance-attributes +class StorageAccount(TrackedResource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. @@ -6201,7 +6200,7 @@ def __init__(self, *, name: str, **kwargs: Any) -> None: self.name = name -class StorageAccountCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountCreateParameters(_serialization.Model): """The parameters used when creating a storage account. All required parameters must be populated in order to send to server. @@ -6682,7 +6681,7 @@ def __init__(self, *, key_name: str, **kwargs: Any) -> None: self.key_name = key_name -class StorageAccountUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountUpdateParameters(_serialization.Model): """The parameters that can be provided when updating the storage account properties. :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/_storage_management_client_enums.py index 1cffd9d76024..01df710050bf 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/_storage_management_client_enums.py @@ -260,6 +260,7 @@ class LeaseContainerRequestAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" @@ -279,6 +280,7 @@ class LeaseShareAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/__init__.py index 0f201012e160..d406c5bf4d6b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/__init__.py @@ -5,29 +5,35 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -51,5 +57,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_containers_operations.py index fd5e13208ba1..5e22b77bf847 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -649,7 +649,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -671,7 +671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -687,7 +686,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -822,7 +820,7 @@ def create( :rtype: ~azure.mgmt.storage.v2021_06_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -857,7 +855,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -871,11 +868,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -985,7 +978,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_06_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1020,7 +1013,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1034,7 +1026,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1063,7 +1055,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_06_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1086,7 +1078,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1100,7 +1091,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1129,7 +1120,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1152,7 +1143,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1275,7 +1265,7 @@ def set_legal_hold( :rtype: ~azure.mgmt.storage.v2021_06_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1310,7 +1300,6 @@ def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1324,7 +1313,7 @@ def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1434,7 +1423,7 @@ def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2021_06_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1469,7 +1458,6 @@ def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1483,7 +1471,7 @@ def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1610,7 +1598,7 @@ def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1651,7 +1639,6 @@ def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1668,7 +1655,7 @@ def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1707,7 +1694,7 @@ def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1733,7 +1720,6 @@ def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1750,7 +1736,7 @@ def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1786,7 +1772,7 @@ def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1812,7 +1798,6 @@ def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1829,7 +1814,7 @@ def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1863,7 +1848,7 @@ def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1887,7 +1872,6 @@ def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1904,7 +1888,7 @@ def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2034,7 +2018,7 @@ def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2073,7 +2057,6 @@ def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2090,7 +2073,7 @@ def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2200,7 +2183,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2021_06_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2238,7 +2221,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2252,17 +2234,17 @@ def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _object_level_worm_initial( # pylint: disable=inconsistent-return-statements + def _object_level_worm_initial( self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2274,7 +2256,7 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_object_level_worm_request( resource_group_name=resource_group_name, @@ -2285,10 +2267,10 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2296,11 +2278,19 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_object_level_worm( @@ -2336,7 +2326,7 @@ def begin_object_level_worm( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._object_level_worm_initial( # type: ignore + raw_result = self._object_level_worm_initial( resource_group_name=resource_group_name, account_name=account_name, container_name=container_name, @@ -2346,6 +2336,7 @@ def begin_object_level_worm( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_inventory_policies_operations.py index 1e2aa0f7ee66..4a842bda00a1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -235,7 +232,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +255,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -273,7 +269,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -377,7 +373,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2021_06_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -412,7 +408,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -427,7 +422,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -459,7 +454,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -482,7 +477,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -524,7 +518,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -543,7 +537,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -559,7 +552,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_services_operations.py index 09517a76d6e6..f103f0af193d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -191,7 +188,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -210,7 +207,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -226,7 +222,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -343,7 +338,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_06_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -379,7 +374,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -393,7 +387,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -418,7 +412,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_06_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -442,7 +436,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -456,7 +449,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_deleted_accounts_operations.py index 6d51302ffe3e..4b7d0b31d62c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -130,7 +127,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.DeletedAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -147,7 +144,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -163,7 +159,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -205,7 +200,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model :rtype: ~azure.mgmt.storage.v2021_06_01.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +222,6 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -242,7 +236,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_encryption_scopes_operations.py index 38d1e98e2dd7..c259b96a1045 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -315,7 +312,7 @@ def put( :rtype: ~azure.mgmt.storage.v2021_06_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -350,7 +347,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -365,11 +361,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -479,7 +471,7 @@ def patch( :rtype: ~azure.mgmt.storage.v2021_06_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -514,7 +506,6 @@ def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -529,7 +520,7 @@ def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -558,7 +549,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_06_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -581,7 +572,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -596,7 +586,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -624,7 +614,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -643,7 +633,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -659,7 +648,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_file_services_operations.py index 09c0e1f15df9..244b6936e719 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -179,7 +176,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2021_06_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -216,7 +212,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -311,7 +307,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_06_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -347,7 +343,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -362,7 +357,7 @@ def set_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -387,7 +382,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_06_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,7 +406,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -426,7 +420,7 @@ def get_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_file_shares_operations.py index b07322e038ce..0d09adc42583 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_file_shares_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -401,7 +399,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +421,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -439,7 +436,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -587,7 +583,7 @@ def create( :rtype: ~azure.mgmt.storage.v2021_06_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -623,7 +619,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -638,11 +633,7 @@ def create( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -752,7 +743,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_06_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -787,7 +778,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -802,7 +792,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -843,7 +833,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_06_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -868,7 +858,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -883,7 +872,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -928,7 +917,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -953,7 +942,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -972,7 +960,7 @@ def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -1007,7 +995,7 @@ def restore( # pylint: disable=inconsistent-return-statements """ @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -1070,7 +1058,7 @@ def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1105,7 +1093,6 @@ def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1238,7 +1225,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2021_06_01.models.LeaseShareResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1277,7 +1264,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1295,7 +1281,7 @@ def lease( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("LeaseShareResponse", pipeline_response) + deserialized = self._deserialize("LeaseShareResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_management_policies_operations.py index 92c800bb0ad2..9077d8e4f4d8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -196,7 +193,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,7 +216,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -233,7 +229,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +333,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +368,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -386,7 +381,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -418,7 +413,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -441,7 +436,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_object_replication_policies_operations.py index e2c9f586f3cd..2a7172988972 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -229,7 +226,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -248,7 +245,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -264,7 +260,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -316,7 +311,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -339,7 +334,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +348,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +458,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +493,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -514,7 +507,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -543,7 +536,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +559,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_operations.py index e5234b1530f7..fd8660356f87 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -126,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_private_endpoint_connections_operations.py index ea3b9f828753..ba7c2d9418b9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -241,7 +238,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,7 +257,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -276,7 +272,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -325,7 +320,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_06_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +343,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -363,7 +357,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +458,7 @@ def put( :rtype: ~azure.mgmt.storage.v2021_06_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +493,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -514,7 +507,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -541,7 +534,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -564,7 +557,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_private_link_resources_operations.py index 964448f398ef..4044c864d9b7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -109,7 +106,7 @@ def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2021_06_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -131,7 +128,6 @@ def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -145,7 +141,7 @@ def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_queue_operations.py index 7344a3114742..7ff993840b86 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -375,7 +372,7 @@ def create( :rtype: ~azure.mgmt.storage.v2021_06_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -410,7 +407,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -425,7 +421,7 @@ def create( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -532,7 +528,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_06_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -567,7 +563,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -582,7 +577,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -609,7 +604,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw :rtype: ~azure.mgmt.storage.v2021_06_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -632,7 +627,6 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -647,7 +641,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -676,7 +670,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -699,7 +693,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -751,7 +744,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -772,7 +765,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -788,7 +780,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_queue_services_operations.py index 7f24a8cf8d0a..05b7ff03adf5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -179,7 +176,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2021_06_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -216,7 +212,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -311,7 +307,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_06_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -347,7 +343,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -362,7 +357,7 @@ def set_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -387,7 +382,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_06_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,7 +406,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -426,7 +420,7 @@ def get_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_skus_operations.py index 87c273564cf4..b86e2ce052ca 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_storage_accounts_operations.py index 1683774b7aad..4f39791c9006 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -649,7 +649,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2021_06_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -681,7 +681,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -695,7 +694,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -708,8 +707,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -722,7 +721,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -743,10 +742,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -754,12 +753,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -882,10 +883,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -924,7 +926,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -946,7 +948,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -991,7 +992,7 @@ def get_properties( :rtype: ~azure.mgmt.storage.v2021_06_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1014,7 +1015,6 @@ def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1028,7 +1028,7 @@ def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1139,7 +1139,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_06_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1173,7 +1173,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1187,7 +1186,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1209,7 +1208,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1226,7 +1225,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1242,7 +1240,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1289,7 +1286,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1307,7 +1304,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1323,7 +1319,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1373,7 +1368,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2021_06_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1396,7 +1391,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1410,7 +1404,7 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1504,7 +1498,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2021_06_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1538,7 +1532,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1552,7 +1545,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1643,7 +1636,7 @@ def list_account_sas( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1677,7 +1670,6 @@ def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1691,7 +1683,7 @@ def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1780,7 +1772,7 @@ def list_service_sas( :rtype: ~azure.mgmt.storage.v2021_06_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1814,7 +1806,6 @@ def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1828,17 +1819,15 @@ def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _failover_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _failover_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1850,7 +1839,7 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1860,10 +1849,10 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1871,11 +1860,19 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1903,7 +1900,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._failover_initial( # type: ignore + raw_result = self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1912,6 +1909,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1935,10 +1933,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, request_type: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1950,7 +1948,7 @@ def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-r _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -1961,10 +1959,10 @@ def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1972,12 +1970,20 @@ def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_hierarchical_namespace_migration( @@ -2010,7 +2016,7 @@ def begin_hierarchical_namespace_migration( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._hierarchical_namespace_migration_initial( # type: ignore + raw_result = self._hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, request_type=request_type, @@ -2020,6 +2026,7 @@ def begin_hierarchical_namespace_migration( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2043,10 +2050,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _abort_hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2058,7 +2065,7 @@ def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_abort_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -2068,10 +2075,10 @@ def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2079,12 +2086,20 @@ def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-long @@ -2112,7 +2127,7 @@ def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-lo lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._abort_hierarchical_namespace_migration_initial( # type: ignore + raw_result = self._abort_hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -2121,6 +2136,7 @@ def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-lo params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2150,8 +2166,8 @@ def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2164,7 +2180,7 @@ def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2185,10 +2201,10 @@ def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2196,14 +2212,14 @@ def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2316,10 +2332,11 @@ def begin_restore_blob_ranges( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2360,7 +2377,7 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2382,7 +2399,6 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_table_operations.py index ce22e2629fa1..f5a48052ebfa 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -255,7 +252,7 @@ def create(self, resource_group_name: str, account_name: str, table_name: str, * :rtype: ~azure.mgmt.storage.v2021_06_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -278,7 +275,6 @@ def create(self, resource_group_name: str, account_name: str, table_name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -293,7 +289,7 @@ def create(self, resource_group_name: str, account_name: str, table_name: str, * error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -319,7 +315,7 @@ def update(self, resource_group_name: str, account_name: str, table_name: str, * :rtype: ~azure.mgmt.storage.v2021_06_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -342,7 +338,6 @@ def update(self, resource_group_name: str, account_name: str, table_name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -357,7 +352,7 @@ def update(self, resource_group_name: str, account_name: str, table_name: str, * error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -383,7 +378,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw :rtype: ~azure.mgmt.storage.v2021_06_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -406,7 +401,6 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -421,7 +415,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -449,7 +443,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -472,7 +466,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -511,7 +504,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -530,7 +523,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -546,7 +538,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_table_services_operations.py index 8801a3709803..5ad86537c251 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -179,7 +176,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2021_06_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -216,7 +212,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -311,7 +307,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_06_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -347,7 +343,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -362,7 +357,7 @@ def set_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -387,7 +382,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_06_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,7 +406,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -426,7 +420,7 @@ def get_service_properties( error = self._deserialize.failsafe_deserialize(_models.CloudErrorAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_usages_operations.py index 4a3c9d02bd25..74be8fe98150 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -105,7 +102,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.Us api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -139,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/__init__.py index a860a5c185c9..60980065e1ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_configuration.py index 66be34441ed7..1de9c74c4dda 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_metadata.json index 0feb8c85b60d..b703b9d865a4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_storage_management_client.py index 08ff81b2be8e..623ab156e0af 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -41,11 +42,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -217,7 +217,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_version.py index 5a163c0afedc..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" \ No newline at end of file +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/__init__.py index a5c3d2414cfd..ee2b940bd4fc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/_configuration.py index 7b440e630a90..4c1e2f028d16 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/_storage_management_client.py index 7ca4b87dd0ad..9882fb41be60 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -41,11 +42,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -222,7 +222,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/__init__.py index bbce85749d18..a0549517e087 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/__init__.py @@ -5,30 +5,36 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._local_users_operations import LocalUsersOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._local_users_operations import LocalUsersOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -53,5 +59,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_containers_operations.py index 3c60276f45e0..42f1b1575dd8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_containers_operations import ( build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, @@ -52,7 +65,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -117,7 +130,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -139,7 +152,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -155,7 +167,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -290,7 +301,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -325,7 +336,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -339,11 +349,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -453,7 +459,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -488,7 +494,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -502,7 +507,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -531,7 +536,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -554,7 +559,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -568,7 +572,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -576,9 +580,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -597,7 +599,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -620,7 +622,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -743,7 +744,7 @@ async def set_legal_hold( :rtype: ~azure.mgmt.storage.v2021_08_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -778,7 +779,6 @@ async def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -792,7 +792,7 @@ async def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -902,7 +902,7 @@ async def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2021_08_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -937,7 +937,6 @@ async def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -951,7 +950,7 @@ async def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1078,7 +1077,7 @@ async def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1119,7 +1118,6 @@ async def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1136,7 +1134,7 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1175,7 +1173,7 @@ async def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1201,7 +1199,6 @@ async def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1218,7 +1215,7 @@ async def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1254,7 +1251,7 @@ async def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1280,7 +1277,6 @@ async def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1297,7 +1293,7 @@ async def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1331,7 +1327,7 @@ async def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1355,7 +1351,6 @@ async def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1372,7 +1367,7 @@ async def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1502,7 +1497,7 @@ async def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1541,7 +1536,6 @@ async def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1558,7 +1552,7 @@ async def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1668,7 +1662,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2021_08_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1706,7 +1700,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1720,17 +1713,17 @@ async def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _object_level_worm_initial( # pylint: disable=inconsistent-return-statements + async def _object_level_worm_initial( self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1742,7 +1735,7 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_object_level_worm_request( resource_group_name=resource_group_name, @@ -1753,10 +1746,10 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1764,11 +1757,19 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_object_level_worm( @@ -1804,7 +1805,7 @@ async def begin_object_level_worm( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._object_level_worm_initial( # type: ignore + raw_result = await self._object_level_worm_initial( resource_group_name=resource_group_name, account_name=account_name, container_name=container_name, @@ -1814,6 +1815,7 @@ async def begin_object_level_worm( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_inventory_policies_operations.py index 3bf3ad5af3ec..4bcb8faaa3f9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_inventory_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,7 +110,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -128,7 +124,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -232,7 +228,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -267,7 +263,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -282,7 +277,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -290,7 +285,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -314,7 +309,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -337,7 +332,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -379,7 +373,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -398,7 +392,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -414,7 +407,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_services_operations.py index 252df2f9d0b5..b83fea307646 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_services_operations import ( build_get_service_properties_request, build_list_request, @@ -39,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +86,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -241,7 +236,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -277,7 +272,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -291,7 +285,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -316,7 +310,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -340,7 +334,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +347,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_deleted_accounts_operations.py index e78e783dcaf4..e4dcb271399b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,21 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_accounts_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DeletedAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +88,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -107,7 +103,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -149,7 +144,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> :rtype: ~azure.mgmt.storage.v2021_08_01.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +166,6 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -186,7 +180,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_encryption_scopes_operations.py index fbcf6f0d9ae7..6c2c4ced9137 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._encryption_scopes_operations import ( build_get_request, build_list_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -173,7 +170,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2021_08_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +205,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -223,11 +219,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +329,7 @@ async def patch( :rtype: ~azure.mgmt.storage.v2021_08_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +364,6 @@ async def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -387,7 +378,7 @@ async def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -416,7 +407,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_08_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -439,7 +430,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -454,7 +444,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -485,7 +475,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +494,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -520,7 +509,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_file_services_operations.py index fdf62a856d2f..fea3295b51be 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -207,7 +203,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +239,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -257,7 +252,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -282,7 +277,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +301,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -320,7 +314,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_file_shares_operations.py index 196ed2f027d8..812ed784f934 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_file_shares_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_shares_operations import ( build_create_request, build_delete_request, @@ -43,7 +40,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -108,7 +105,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -130,7 +127,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -146,7 +142,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -293,7 +288,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -329,7 +324,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -343,11 +337,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -457,7 +447,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -492,7 +482,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -506,7 +495,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -547,7 +536,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -572,7 +561,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -586,7 +574,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -594,7 +582,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -631,7 +619,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -656,7 +644,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -674,7 +661,7 @@ async def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -709,7 +696,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -744,7 +731,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -772,7 +759,7 @@ async def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -807,7 +794,6 @@ async def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -939,7 +925,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2021_08_01.models.LeaseShareResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -978,7 +964,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -995,7 +980,7 @@ async def lease( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("LeaseShareResponse", pipeline_response) + deserialized = self._deserialize("LeaseShareResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_local_users_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_local_users_operations.py index 88ad058e449a..4e56e496e4bf 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_local_users_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_local_users_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._local_users_operations import ( build_create_or_update_request, build_delete_request, @@ -42,7 +39,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +86,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.LocalUsers] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -172,7 +167,7 @@ async def get(self, resource_group_name: str, account_name: str, username: str, :rtype: ~azure.mgmt.storage.v2021_08_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -195,7 +190,6 @@ async def get(self, resource_group_name: str, account_name: str, username: str, headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -210,7 +204,7 @@ async def get(self, resource_group_name: str, account_name: str, username: str, error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -311,7 +305,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2021_08_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +340,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -361,7 +354,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -369,9 +362,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, username: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, username: str, **kwargs: Any) -> None: """Deletes the local user associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -388,7 +379,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,7 +402,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -449,7 +439,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2021_08_01.models.LocalUserKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -472,7 +462,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -487,7 +476,7 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserKeys", pipeline_response) + deserialized = self._deserialize("LocalUserKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -514,7 +503,7 @@ async def regenerate_password( :rtype: ~azure.mgmt.storage.v2021_08_01.models.LocalUserRegeneratePasswordResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -537,7 +526,6 @@ async def regenerate_password( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -552,7 +540,7 @@ async def regenerate_password( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response) + deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_management_policies_operations.py index 9d8de1146a7d..dc05cc091a59 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._management_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +119,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -227,7 +223,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -262,7 +258,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -276,7 +271,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -284,7 +279,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -308,7 +303,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +326,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_object_replication_policies_operations.py index 02f797f0caa0..7c25d5cb8b59 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._object_replication_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -177,7 +172,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -200,7 +195,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +209,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -325,7 +319,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -360,7 +354,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -375,7 +368,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -383,7 +376,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, object_replication_policy_id: str, **kwargs: Any ) -> None: """Deletes the object replication policy associated with the specified storage account. @@ -404,7 +397,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +420,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_operations.py index ea25226df226..fd80dcc0a15e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_private_endpoint_connections_operations.py index bd29831dca33..ab5fa05ad4dd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connections_operations import ( build_delete_request, build_get_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -174,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_08_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -197,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -212,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -313,7 +307,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2021_08_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +342,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -363,7 +356,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -371,7 +364,7 @@ async def put( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: """Deletes the specified private endpoint connection associated with the storage account. @@ -390,7 +383,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -413,7 +406,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_private_link_resources_operations.py index caf48f3dca5c..8b682851c5ec 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_by_storage_account_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ async def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2021_08_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,7 +92,6 @@ async def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +105,7 @@ async def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_queue_operations.py index b379ad307a7a..55af140fa625 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_operations import ( build_create_request, build_delete_request, @@ -41,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -166,7 +163,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -322,7 +318,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -357,7 +353,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -371,7 +366,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -400,7 +395,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +418,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -437,7 +431,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -445,9 +439,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any) -> None: """Deletes the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -466,7 +458,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -489,7 +481,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -541,7 +532,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -562,7 +553,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -578,7 +568,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_queue_services_operations.py index 0eeccb2f2352..4085d6354290 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2021_08_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -207,7 +203,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_08_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +239,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -257,7 +252,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -282,7 +277,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_08_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +301,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -320,7 +314,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_skus_operations.py index 8993bfbb841f..3d8134acb65f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -90,7 +87,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -106,7 +102,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_storage_accounts_operations.py index b40b786af1d1..c4bd74c8f4ca 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_abort_hierarchical_namespace_migration_request, build_check_name_availability_request, @@ -54,7 +67,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -137,7 +150,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2021_08_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -169,7 +182,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -183,7 +195,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -196,8 +208,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -210,7 +222,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -231,10 +243,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -242,12 +254,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -373,10 +387,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -399,9 +414,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -415,7 +428,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -437,7 +450,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -482,7 +494,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -505,7 +517,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -519,7 +530,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -630,7 +641,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -664,7 +675,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -678,7 +688,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -701,7 +711,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -718,7 +728,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -734,7 +743,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -784,7 +792,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -802,7 +810,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -818,7 +825,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -868,7 +874,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -891,7 +897,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -905,7 +910,7 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -999,7 +1004,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1033,7 +1038,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1047,7 +1051,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1138,7 +1142,7 @@ async def list_account_sas( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1172,7 +1176,6 @@ async def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1186,7 +1189,7 @@ async def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1275,7 +1278,7 @@ async def list_service_sas( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1309,7 +1312,6 @@ async def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1323,17 +1325,17 @@ async def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _failover_initial( # pylint: disable=inconsistent-return-statements + async def _failover_initial( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1345,7 +1347,7 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1355,10 +1357,10 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1366,11 +1368,19 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1398,7 +1408,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._failover_initial( # type: ignore + raw_result = await self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1407,6 +1417,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1430,10 +1441,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, request_type: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1445,7 +1456,7 @@ async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -1456,10 +1467,10 @@ async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1467,12 +1478,20 @@ async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_hierarchical_namespace_migration( @@ -1505,7 +1524,7 @@ async def begin_hierarchical_namespace_migration( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._hierarchical_namespace_migration_initial( # type: ignore + raw_result = await self._hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, request_type=request_type, @@ -1515,6 +1534,7 @@ async def begin_hierarchical_namespace_migration( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1538,10 +1558,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1553,7 +1573,7 @@ async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=in _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_abort_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -1563,10 +1583,10 @@ async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=in headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1574,12 +1594,20 @@ async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-long @@ -1607,7 +1635,7 @@ async def begin_abort_hierarchical_namespace_migration( # pylint: disable=name- lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._abort_hierarchical_namespace_migration_initial( # type: ignore + raw_result = await self._abort_hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1616,6 +1644,7 @@ async def begin_abort_hierarchical_namespace_migration( # pylint: disable=name- params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1645,8 +1674,8 @@ async def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1659,7 +1688,7 @@ async def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1680,10 +1709,10 @@ async def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1691,14 +1720,14 @@ async def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1814,10 +1843,11 @@ async def begin_restore_blob_ranges( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1842,9 +1872,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def revoke_user_delegation_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1858,7 +1886,7 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1880,7 +1908,6 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_table_operations.py index dfdca9390935..fb9a5a578b8a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_operations import ( build_create_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_08_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +119,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -151,7 +147,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_08_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -174,7 +170,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -188,7 +183,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -214,7 +209,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str :rtype: ~azure.mgmt.storage.v2021_08_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -237,7 +232,6 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -251,7 +245,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -259,9 +253,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any) -> None: """Deletes the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -279,7 +271,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -302,7 +294,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -340,7 +331,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -359,7 +350,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -375,7 +365,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_table_services_operations.py index a5283a549439..0f0aec3768b6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2021_08_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -207,7 +203,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_08_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +239,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -257,7 +252,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -282,7 +277,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_08_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +301,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -320,7 +314,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_usages_operations.py index 4b492a5cde16..1167e1364a8e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/aio/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usages_operations import build_list_by_location_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +72,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_mode api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -109,7 +105,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/__init__.py index a74858b74e08..d9b586893099 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/__init__.py @@ -5,217 +5,228 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccessPolicy -from ._models_py3 import AccountImmutabilityPolicyProperties -from ._models_py3 import AccountSasParameters -from ._models_py3 import ActiveDirectoryProperties -from ._models_py3 import AzureEntityResource -from ._models_py3 import AzureFilesIdentityBasedAuthentication -from ._models_py3 import BlobContainer -from ._models_py3 import BlobInventoryPolicy -from ._models_py3 import BlobInventoryPolicyDefinition -from ._models_py3 import BlobInventoryPolicyFilter -from ._models_py3 import BlobInventoryPolicyRule -from ._models_py3 import BlobInventoryPolicySchema -from ._models_py3 import BlobRestoreParameters -from ._models_py3 import BlobRestoreRange -from ._models_py3 import BlobRestoreStatus -from ._models_py3 import BlobServiceItems -from ._models_py3 import BlobServiceProperties -from ._models_py3 import ChangeFeed -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CloudErrorBody -from ._models_py3 import CorsRule -from ._models_py3 import CorsRules -from ._models_py3 import CustomDomain -from ._models_py3 import DateAfterCreation -from ._models_py3 import DateAfterModification -from ._models_py3 import DeleteRetentionPolicy -from ._models_py3 import DeletedAccount -from ._models_py3 import DeletedAccountListResult -from ._models_py3 import DeletedShare -from ._models_py3 import Dimension -from ._models_py3 import Encryption -from ._models_py3 import EncryptionIdentity -from ._models_py3 import EncryptionScope -from ._models_py3 import EncryptionScopeKeyVaultProperties -from ._models_py3 import EncryptionScopeListResult -from ._models_py3 import EncryptionService -from ._models_py3 import EncryptionServices -from ._models_py3 import Endpoints -from ._models_py3 import ErrorResponse -from ._models_py3 import ErrorResponseBody -from ._models_py3 import ExtendedLocation -from ._models_py3 import FileServiceItems -from ._models_py3 import FileServiceProperties -from ._models_py3 import FileShare -from ._models_py3 import FileShareItem -from ._models_py3 import FileShareItems -from ._models_py3 import GeoReplicationStats -from ._models_py3 import IPRule -from ._models_py3 import Identity -from ._models_py3 import ImmutabilityPolicy -from ._models_py3 import ImmutabilityPolicyProperties -from ._models_py3 import ImmutableStorageAccount -from ._models_py3 import ImmutableStorageWithVersioning -from ._models_py3 import KeyCreationTime -from ._models_py3 import KeyPolicy -from ._models_py3 import KeyVaultProperties -from ._models_py3 import LastAccessTimeTrackingPolicy -from ._models_py3 import LeaseContainerRequest -from ._models_py3 import LeaseContainerResponse -from ._models_py3 import LeaseShareRequest -from ._models_py3 import LeaseShareResponse -from ._models_py3 import LegalHold -from ._models_py3 import LegalHoldProperties -from ._models_py3 import ListAccountSasResponse -from ._models_py3 import ListBlobInventoryPolicy -from ._models_py3 import ListContainerItem -from ._models_py3 import ListContainerItems -from ._models_py3 import ListQueue -from ._models_py3 import ListQueueResource -from ._models_py3 import ListQueueServices -from ._models_py3 import ListServiceSasResponse -from ._models_py3 import ListTableResource -from ._models_py3 import ListTableServices -from ._models_py3 import LocalUser -from ._models_py3 import LocalUserKeys -from ._models_py3 import LocalUserRegeneratePasswordResult -from ._models_py3 import LocalUsers -from ._models_py3 import ManagementPolicy -from ._models_py3 import ManagementPolicyAction -from ._models_py3 import ManagementPolicyBaseBlob -from ._models_py3 import ManagementPolicyDefinition -from ._models_py3 import ManagementPolicyFilter -from ._models_py3 import ManagementPolicyRule -from ._models_py3 import ManagementPolicySchema -from ._models_py3 import ManagementPolicySnapShot -from ._models_py3 import ManagementPolicyVersion -from ._models_py3 import MetricSpecification -from ._models_py3 import Multichannel -from ._models_py3 import NetworkRuleSet -from ._models_py3 import ObjectReplicationPolicies -from ._models_py3 import ObjectReplicationPolicy -from ._models_py3 import ObjectReplicationPolicyFilter -from ._models_py3 import ObjectReplicationPolicyRule -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import PermissionScope -from ._models_py3 import PrivateEndpoint -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionListResult -from ._models_py3 import PrivateLinkResource -from ._models_py3 import PrivateLinkResourceListResult -from ._models_py3 import PrivateLinkServiceConnectionState -from ._models_py3 import ProtectedAppendWritesHistory -from ._models_py3 import ProtocolSettings -from ._models_py3 import ProxyResource -from ._models_py3 import QueueServiceProperties -from ._models_py3 import Resource -from ._models_py3 import ResourceAccessRule -from ._models_py3 import RestorePolicyProperties -from ._models_py3 import Restriction -from ._models_py3 import RoutingPreference -from ._models_py3 import SKUCapability -from ._models_py3 import SasPolicy -from ._models_py3 import ServiceSasParameters -from ._models_py3 import ServiceSpecification -from ._models_py3 import SignedIdentifier -from ._models_py3 import Sku -from ._models_py3 import SkuInformation -from ._models_py3 import SmbSetting -from ._models_py3 import SshPublicKey -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountInternetEndpoints -from ._models_py3 import StorageAccountKey -from ._models_py3 import StorageAccountListKeysResult -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountMicrosoftEndpoints -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import StorageQueue -from ._models_py3 import StorageSkuListResult -from ._models_py3 import SystemData -from ._models_py3 import Table -from ._models_py3 import TableServiceProperties -from ._models_py3 import TagFilter -from ._models_py3 import TagProperty -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateHistoryProperty -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName -from ._models_py3 import UserAssignedIdentity -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._storage_management_client_enums import AccessTier -from ._storage_management_client_enums import AccountImmutabilityPolicyState -from ._storage_management_client_enums import AccountStatus -from ._storage_management_client_enums import ActiveDirectoryPropertiesAccountType -from ._storage_management_client_enums import AllowedCopyScope -from ._storage_management_client_enums import BlobInventoryPolicyName -from ._storage_management_client_enums import BlobRestoreProgressStatus -from ._storage_management_client_enums import Bypass -from ._storage_management_client_enums import CorsRuleAllowedMethodsItem -from ._storage_management_client_enums import CreatedByType -from ._storage_management_client_enums import DefaultAction -from ._storage_management_client_enums import DefaultSharePermission -from ._storage_management_client_enums import DirectoryServiceOptions -from ._storage_management_client_enums import EnabledProtocols -from ._storage_management_client_enums import EncryptionScopeSource -from ._storage_management_client_enums import EncryptionScopeState -from ._storage_management_client_enums import ExpirationAction -from ._storage_management_client_enums import ExtendedLocationTypes -from ._storage_management_client_enums import Format -from ._storage_management_client_enums import GeoReplicationStatus -from ._storage_management_client_enums import HttpProtocol -from ._storage_management_client_enums import IdentityType -from ._storage_management_client_enums import ImmutabilityPolicyState -from ._storage_management_client_enums import ImmutabilityPolicyUpdateType -from ._storage_management_client_enums import InventoryRuleType -from ._storage_management_client_enums import KeyPermission -from ._storage_management_client_enums import KeySource -from ._storage_management_client_enums import KeyType -from ._storage_management_client_enums import Kind -from ._storage_management_client_enums import LargeFileSharesState -from ._storage_management_client_enums import LeaseContainerRequestAction -from ._storage_management_client_enums import LeaseDuration -from ._storage_management_client_enums import LeaseShareAction -from ._storage_management_client_enums import LeaseState -from ._storage_management_client_enums import LeaseStatus -from ._storage_management_client_enums import ListContainersInclude -from ._storage_management_client_enums import ManagementPolicyName -from ._storage_management_client_enums import MigrationState -from ._storage_management_client_enums import MinimumTlsVersion -from ._storage_management_client_enums import Name -from ._storage_management_client_enums import ObjectType -from ._storage_management_client_enums import Permissions -from ._storage_management_client_enums import PrivateEndpointConnectionProvisioningState -from ._storage_management_client_enums import PrivateEndpointServiceConnectionStatus -from ._storage_management_client_enums import ProvisioningState -from ._storage_management_client_enums import PublicAccess -from ._storage_management_client_enums import PublicNetworkAccess -from ._storage_management_client_enums import Reason -from ._storage_management_client_enums import ReasonCode -from ._storage_management_client_enums import RootSquashType -from ._storage_management_client_enums import RoutingChoice -from ._storage_management_client_enums import RuleType -from ._storage_management_client_enums import Schedule -from ._storage_management_client_enums import Services -from ._storage_management_client_enums import ShareAccessTier -from ._storage_management_client_enums import SignedResource -from ._storage_management_client_enums import SignedResourceTypes -from ._storage_management_client_enums import SkuName -from ._storage_management_client_enums import SkuTier -from ._storage_management_client_enums import State -from ._storage_management_client_enums import StorageAccountExpand -from ._storage_management_client_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccessPolicy, + AccountImmutabilityPolicyProperties, + AccountSasParameters, + ActiveDirectoryProperties, + AzureEntityResource, + AzureFilesIdentityBasedAuthentication, + BlobContainer, + BlobInventoryPolicy, + BlobInventoryPolicyDefinition, + BlobInventoryPolicyFilter, + BlobInventoryPolicyRule, + BlobInventoryPolicySchema, + BlobRestoreParameters, + BlobRestoreRange, + BlobRestoreStatus, + BlobServiceItems, + BlobServiceProperties, + ChangeFeed, + CheckNameAvailabilityResult, + CloudErrorBody, + CorsRule, + CorsRules, + CustomDomain, + DateAfterCreation, + DateAfterModification, + DeleteRetentionPolicy, + DeletedAccount, + DeletedAccountListResult, + DeletedShare, + Dimension, + Encryption, + EncryptionIdentity, + EncryptionScope, + EncryptionScopeKeyVaultProperties, + EncryptionScopeListResult, + EncryptionService, + EncryptionServices, + Endpoints, + ErrorResponse, + ErrorResponseBody, + ExtendedLocation, + FileServiceItems, + FileServiceProperties, + FileShare, + FileShareItem, + FileShareItems, + GeoReplicationStats, + IPRule, + Identity, + ImmutabilityPolicy, + ImmutabilityPolicyProperties, + ImmutableStorageAccount, + ImmutableStorageWithVersioning, + KeyCreationTime, + KeyPolicy, + KeyVaultProperties, + LastAccessTimeTrackingPolicy, + LeaseContainerRequest, + LeaseContainerResponse, + LeaseShareRequest, + LeaseShareResponse, + LegalHold, + LegalHoldProperties, + ListAccountSasResponse, + ListBlobInventoryPolicy, + ListContainerItem, + ListContainerItems, + ListQueue, + ListQueueResource, + ListQueueServices, + ListServiceSasResponse, + ListTableResource, + ListTableServices, + LocalUser, + LocalUserKeys, + LocalUserRegeneratePasswordResult, + LocalUsers, + ManagementPolicy, + ManagementPolicyAction, + ManagementPolicyBaseBlob, + ManagementPolicyDefinition, + ManagementPolicyFilter, + ManagementPolicyRule, + ManagementPolicySchema, + ManagementPolicySnapShot, + ManagementPolicyVersion, + MetricSpecification, + Multichannel, + NetworkRuleSet, + ObjectReplicationPolicies, + ObjectReplicationPolicy, + ObjectReplicationPolicyFilter, + ObjectReplicationPolicyRule, + Operation, + OperationDisplay, + OperationListResult, + PermissionScope, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionListResult, + PrivateLinkResource, + PrivateLinkResourceListResult, + PrivateLinkServiceConnectionState, + ProtectedAppendWritesHistory, + ProtocolSettings, + ProxyResource, + QueueServiceProperties, + Resource, + ResourceAccessRule, + RestorePolicyProperties, + Restriction, + RoutingPreference, + SKUCapability, + SasPolicy, + ServiceSasParameters, + ServiceSpecification, + SignedIdentifier, + Sku, + SkuInformation, + SmbSetting, + SshPublicKey, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountInternetEndpoints, + StorageAccountKey, + StorageAccountListKeysResult, + StorageAccountListResult, + StorageAccountMicrosoftEndpoints, + StorageAccountRegenerateKeyParameters, + StorageAccountUpdateParameters, + StorageQueue, + StorageSkuListResult, + SystemData, + Table, + TableServiceProperties, + TagFilter, + TagProperty, + TrackedResource, + UpdateHistoryProperty, + Usage, + UsageListResult, + UsageName, + UserAssignedIdentity, + VirtualNetworkRule, +) + +from ._storage_management_client_enums import ( # type: ignore + AccessTier, + AccountImmutabilityPolicyState, + AccountStatus, + ActiveDirectoryPropertiesAccountType, + AllowedCopyScope, + BlobInventoryPolicyName, + BlobRestoreProgressStatus, + Bypass, + CorsRuleAllowedMethodsItem, + CreatedByType, + DefaultAction, + DefaultSharePermission, + DirectoryServiceOptions, + EnabledProtocols, + EncryptionScopeSource, + EncryptionScopeState, + ExpirationAction, + ExtendedLocationTypes, + Format, + GeoReplicationStatus, + HttpProtocol, + IdentityType, + ImmutabilityPolicyState, + ImmutabilityPolicyUpdateType, + InventoryRuleType, + KeyPermission, + KeySource, + KeyType, + Kind, + LargeFileSharesState, + LeaseContainerRequestAction, + LeaseDuration, + LeaseShareAction, + LeaseState, + LeaseStatus, + ListContainersInclude, + ManagementPolicyName, + MigrationState, + MinimumTlsVersion, + Name, + ObjectType, + Permissions, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProvisioningState, + PublicAccess, + PublicNetworkAccess, + Reason, + ReasonCode, + RootSquashType, + RoutingChoice, + RuleType, + Schedule, + Services, + ShareAccessTier, + SignedResource, + SignedResourceTypes, + SkuName, + SkuTier, + State, + StorageAccountExpand, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -427,5 +438,5 @@ "StorageAccountExpand", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/_models_py3.py index 49ab5097390b..9da753a07b02 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,7 +13,6 @@ from ... import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -444,7 +443,7 @@ def __init__( self.default_share_permission = default_share_permission -class BlobContainer(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class BlobContainer(AzureEntityResource): """Properties of the blob container, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -1057,7 +1056,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class BlobServiceProperties(Resource): # pylint: disable=too-many-instance-attributes +class BlobServiceProperties(Resource): """The properties of a storage account’s Blob service. Variables are only populated by the server, and will be ignored when sending a request. @@ -2316,7 +2315,7 @@ def __init__( self.protocol_settings = protocol_settings -class FileShare(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShare(AzureEntityResource): """Properties of the file share, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -2474,7 +2473,7 @@ def __init__( self.snapshot_time = None -class FileShareItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShareItem(AzureEntityResource): """The file share properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -3229,7 +3228,7 @@ class LeaseContainerRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2021_08_01.models.LeaseContainerRequestAction :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -3268,7 +3267,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2021_08_01.models.LeaseContainerRequestAction :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -3326,7 +3325,7 @@ class LeaseShareRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2021_08_01.models.LeaseShareAction :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -3365,7 +3364,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2021_08_01.models.LeaseShareAction :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -3563,7 +3562,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class ListContainerItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class ListContainerItem(AzureEntityResource): """The blob container properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -3931,7 +3930,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class LocalUser(Resource): # pylint: disable=too-many-instance-attributes +class LocalUser(Resource): """The local user associated with the storage accounts. Variables are only populated by the server, and will be ignored when sending a request. @@ -5529,7 +5528,7 @@ def __init__( self.expiration_action = expiration_action -class ServiceSasParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ServiceSasParameters(_serialization.Model): """The parameters to list service SAS credentials of a specific resource. All required parameters must be populated in order to send to server. @@ -5963,7 +5962,7 @@ class SshPublicKey(_serialization.Model): :ivar description: Optional. It is used to store the function/usage of the key. :vartype description: str - :ivar key: Ssh public key base64 encoded. The format should be: ':code:`` + :ivar key: Ssh public key base64 encoded. The format should be: '\\ :code:`` :code:``', e.g. ssh-rsa AAAABBBB. :vartype key: str """ @@ -5977,7 +5976,7 @@ def __init__(self, *, description: Optional[str] = None, key: Optional[str] = No """ :keyword description: Optional. It is used to store the function/usage of the key. :paramtype description: str - :keyword key: Ssh public key base64 encoded. The format should be: ':code:`` + :keyword key: Ssh public key base64 encoded. The format should be: '\\ :code:`` :code:``', e.g. ssh-rsa AAAABBBB. :paramtype key: str """ @@ -6035,7 +6034,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class StorageAccount(TrackedResource): # pylint: disable=too-many-instance-attributes +class StorageAccount(TrackedResource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. @@ -6426,7 +6425,7 @@ def __init__(self, *, name: str, **kwargs: Any) -> None: self.name = name -class StorageAccountCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountCreateParameters(_serialization.Model): """The parameters used when creating a storage account. All required parameters must be populated in order to send to server. @@ -6930,7 +6929,7 @@ def __init__(self, *, key_name: str, **kwargs: Any) -> None: self.key_name = key_name -class StorageAccountUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountUpdateParameters(_serialization.Model): """The parameters that can be provided when updating the storage account properties. :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/_storage_management_client_enums.py index cc58b31a097a..fc793d2bab73 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/_storage_management_client_enums.py @@ -276,6 +276,7 @@ class LeaseContainerRequestAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" @@ -295,6 +296,7 @@ class LeaseShareAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/__init__.py index bbce85749d18..a0549517e087 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/__init__.py @@ -5,30 +5,36 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._local_users_operations import LocalUsersOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._local_users_operations import LocalUsersOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -53,5 +59,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_containers_operations.py index 2f35170db5f6..feddb31f3148 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -649,7 +649,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -671,7 +671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -687,7 +686,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -822,7 +820,7 @@ def create( :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -857,7 +855,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -871,11 +868,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -985,7 +978,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1020,7 +1013,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1034,7 +1026,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1063,7 +1055,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1086,7 +1078,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1100,7 +1091,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1129,7 +1120,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1152,7 +1143,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1275,7 +1265,7 @@ def set_legal_hold( :rtype: ~azure.mgmt.storage.v2021_08_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1310,7 +1300,6 @@ def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1324,7 +1313,7 @@ def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1434,7 +1423,7 @@ def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2021_08_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1469,7 +1458,6 @@ def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1483,7 +1471,7 @@ def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1610,7 +1598,7 @@ def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1651,7 +1639,6 @@ def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1668,7 +1655,7 @@ def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1707,7 +1694,7 @@ def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1733,7 +1720,6 @@ def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1750,7 +1736,7 @@ def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1786,7 +1772,7 @@ def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1812,7 +1798,6 @@ def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1829,7 +1814,7 @@ def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1863,7 +1848,7 @@ def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1887,7 +1872,6 @@ def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1904,7 +1888,7 @@ def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2034,7 +2018,7 @@ def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2073,7 +2057,6 @@ def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2090,7 +2073,7 @@ def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2200,7 +2183,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2021_08_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2238,7 +2221,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2252,17 +2234,17 @@ def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _object_level_worm_initial( # pylint: disable=inconsistent-return-statements + def _object_level_worm_initial( self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2274,7 +2256,7 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_object_level_worm_request( resource_group_name=resource_group_name, @@ -2285,10 +2267,10 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2296,11 +2278,19 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_object_level_worm( @@ -2336,7 +2326,7 @@ def begin_object_level_worm( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._object_level_worm_initial( # type: ignore + raw_result = self._object_level_worm_initial( resource_group_name=resource_group_name, account_name=account_name, container_name=container_name, @@ -2346,6 +2336,7 @@ def begin_object_level_worm( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_inventory_policies_operations.py index c4d305106d8d..64b32ebd7304 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -235,7 +232,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +255,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -273,7 +269,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -377,7 +373,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -412,7 +408,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -427,7 +422,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -459,7 +454,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -482,7 +477,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -524,7 +518,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -543,7 +537,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -559,7 +552,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_services_operations.py index d6388ba48216..8626211ac667 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -191,7 +188,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -210,7 +207,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -226,7 +222,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -343,7 +338,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -379,7 +374,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -393,7 +387,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -418,7 +412,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_08_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -442,7 +436,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -456,7 +449,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_deleted_accounts_operations.py index a76147a14102..727f3a9d876a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -130,7 +127,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.DeletedAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -147,7 +144,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -163,7 +159,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -205,7 +200,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model :rtype: ~azure.mgmt.storage.v2021_08_01.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +222,6 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -242,7 +236,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_encryption_scopes_operations.py index d3f79089c249..12009d0780e4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -315,7 +312,7 @@ def put( :rtype: ~azure.mgmt.storage.v2021_08_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -350,7 +347,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -365,11 +361,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -479,7 +471,7 @@ def patch( :rtype: ~azure.mgmt.storage.v2021_08_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -514,7 +506,6 @@ def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -529,7 +520,7 @@ def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -558,7 +549,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_08_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -581,7 +572,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -596,7 +586,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -624,7 +614,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -643,7 +633,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -659,7 +648,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_file_services_operations.py index 10444d0be5f5..8bdd889b150c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -179,7 +176,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -310,7 +306,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +342,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -360,7 +355,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -385,7 +380,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -409,7 +404,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -423,7 +417,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_file_shares_operations.py index 0ff00855c7e8..45971ecc471c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_file_shares_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -401,7 +399,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +421,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -439,7 +436,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -586,7 +582,7 @@ def create( :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -622,7 +618,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -636,11 +631,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -750,7 +741,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -785,7 +776,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -799,7 +789,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -840,7 +830,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_08_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -865,7 +855,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -879,7 +868,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -924,7 +913,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -949,7 +938,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -967,7 +955,7 @@ def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -1002,7 +990,7 @@ def restore( # pylint: disable=inconsistent-return-statements """ @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -1065,7 +1053,7 @@ def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1100,7 +1088,6 @@ def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1232,7 +1219,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2021_08_01.models.LeaseShareResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1271,7 +1258,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1288,7 +1274,7 @@ def lease( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("LeaseShareResponse", pipeline_response) + deserialized = self._deserialize("LeaseShareResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_local_users_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_local_users_operations.py index 68979da57553..889b61e432c0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_local_users_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_local_users_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -287,7 +284,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.LocalUsers] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +303,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -322,7 +318,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -370,7 +365,7 @@ def get(self, resource_group_name: str, account_name: str, username: str, **kwar :rtype: ~azure.mgmt.storage.v2021_08_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -393,7 +388,6 @@ def get(self, resource_group_name: str, account_name: str, username: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -408,7 +402,7 @@ def get(self, resource_group_name: str, account_name: str, username: str, **kwar error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -509,7 +503,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2021_08_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -544,7 +538,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -559,7 +552,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -586,7 +579,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -609,7 +602,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -647,7 +639,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2021_08_01.models.LocalUserKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -670,7 +662,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -685,7 +676,7 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserKeys", pipeline_response) + deserialized = self._deserialize("LocalUserKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -712,7 +703,7 @@ def regenerate_password( :rtype: ~azure.mgmt.storage.v2021_08_01.models.LocalUserRegeneratePasswordResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -735,7 +726,6 @@ def regenerate_password( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -750,7 +740,7 @@ def regenerate_password( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response) + deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_management_policies_operations.py index 57a0be97814b..247aed4d3473 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -196,7 +193,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,7 +216,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -233,7 +229,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +333,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +368,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -386,7 +381,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -418,7 +413,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -441,7 +436,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_object_replication_policies_operations.py index 06bf8cc91646..82014a9185e3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -229,7 +226,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -248,7 +245,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -264,7 +260,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -316,7 +311,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -339,7 +334,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +348,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +458,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +493,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -514,7 +507,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -543,7 +536,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +559,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_operations.py index 9bc97e1b9478..e61f6ab48b5b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -126,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_private_endpoint_connections_operations.py index 9873447dbabb..692d5b29ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -241,7 +238,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,7 +257,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -276,7 +272,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -325,7 +320,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_08_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +343,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -363,7 +357,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +458,7 @@ def put( :rtype: ~azure.mgmt.storage.v2021_08_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +493,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -514,7 +507,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -541,7 +534,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -564,7 +557,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_private_link_resources_operations.py index 8a0b95c2382e..ebe60e547699 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -109,7 +106,7 @@ def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2021_08_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -131,7 +128,6 @@ def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -145,7 +141,7 @@ def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_queue_operations.py index 8a247a770076..623ea68f948c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -375,7 +372,7 @@ def create( :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -410,7 +407,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -424,7 +420,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -531,7 +527,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +562,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -580,7 +575,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -607,7 +602,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -630,7 +625,6 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -644,7 +638,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -673,7 +667,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -696,7 +690,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -747,7 +740,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -768,7 +761,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -784,7 +776,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_queue_services_operations.py index 547a52f4847c..06b360ec7d05 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -179,7 +176,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2021_08_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -310,7 +306,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_08_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +342,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -360,7 +355,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -385,7 +380,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_08_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -409,7 +404,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -423,7 +417,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_skus_operations.py index dadecc647a04..49bf0f2769e0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_storage_accounts_operations.py index 3d2da0f70008..a7d6fc103a68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -649,7 +649,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2021_08_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -681,7 +681,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -695,7 +694,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -708,8 +707,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -722,7 +721,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -743,10 +742,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -754,12 +753,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -882,10 +883,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -924,7 +926,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -946,7 +948,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -991,7 +992,7 @@ def get_properties( :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1014,7 +1015,6 @@ def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1028,7 +1028,7 @@ def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1139,7 +1139,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1173,7 +1173,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1187,7 +1186,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1209,7 +1208,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1226,7 +1225,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1242,7 +1240,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1289,7 +1286,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1307,7 +1304,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1323,7 +1319,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1373,7 +1368,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1396,7 +1391,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1410,7 +1404,7 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1504,7 +1498,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2021_08_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1538,7 +1532,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1552,7 +1545,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1643,7 +1636,7 @@ def list_account_sas( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1677,7 +1670,6 @@ def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1691,7 +1683,7 @@ def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1780,7 +1772,7 @@ def list_service_sas( :rtype: ~azure.mgmt.storage.v2021_08_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1814,7 +1806,6 @@ def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1828,17 +1819,15 @@ def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _failover_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _failover_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1850,7 +1839,7 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1860,10 +1849,10 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1871,11 +1860,19 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1903,7 +1900,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._failover_initial( # type: ignore + raw_result = self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1912,6 +1909,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1935,10 +1933,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, request_type: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1950,7 +1948,7 @@ def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-r _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -1961,10 +1959,10 @@ def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1972,12 +1970,20 @@ def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_hierarchical_namespace_migration( @@ -2010,7 +2016,7 @@ def begin_hierarchical_namespace_migration( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._hierarchical_namespace_migration_initial( # type: ignore + raw_result = self._hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, request_type=request_type, @@ -2020,6 +2026,7 @@ def begin_hierarchical_namespace_migration( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2043,10 +2050,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _abort_hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2058,7 +2065,7 @@ def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_abort_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -2068,10 +2075,10 @@ def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2079,12 +2086,20 @@ def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-long @@ -2112,7 +2127,7 @@ def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-lo lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._abort_hierarchical_namespace_migration_initial( # type: ignore + raw_result = self._abort_hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -2121,6 +2136,7 @@ def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-lo params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2150,8 +2166,8 @@ def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2164,7 +2180,7 @@ def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2185,10 +2201,10 @@ def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2196,14 +2212,14 @@ def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2316,10 +2332,11 @@ def begin_restore_blob_ranges( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2360,7 +2377,7 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2382,7 +2399,6 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_table_operations.py index 392047979064..927a7b87847e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -255,7 +252,7 @@ def create(self, resource_group_name: str, account_name: str, table_name: str, * :rtype: ~azure.mgmt.storage.v2021_08_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -278,7 +275,6 @@ def create(self, resource_group_name: str, account_name: str, table_name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -292,7 +288,7 @@ def create(self, resource_group_name: str, account_name: str, table_name: str, * map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -318,7 +314,7 @@ def update(self, resource_group_name: str, account_name: str, table_name: str, * :rtype: ~azure.mgmt.storage.v2021_08_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -341,7 +337,6 @@ def update(self, resource_group_name: str, account_name: str, table_name: str, * headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -355,7 +350,7 @@ def update(self, resource_group_name: str, account_name: str, table_name: str, * map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -381,7 +376,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw :rtype: ~azure.mgmt.storage.v2021_08_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -404,7 +399,6 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -418,7 +412,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -446,7 +440,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -469,7 +463,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -507,7 +500,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -526,7 +519,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -542,7 +534,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_table_services_operations.py index 209759df9e18..0c3ed15cd3e2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -179,7 +176,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2021_08_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -310,7 +306,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_08_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +342,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -360,7 +355,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -385,7 +380,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_08_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -409,7 +404,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -423,7 +417,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_usages_operations.py index 2d708900e11e..3142922dbaf2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -105,7 +102,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.Us api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-08-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -139,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/__init__.py index a860a5c185c9..60980065e1ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/_configuration.py index 98c6fb75bea0..a1bffe64415d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/_metadata.json index d704051e9df9..fe3851a8c4be 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/_storage_management_client.py index ebb0de4cb29f..88fcfe44eca3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -41,11 +42,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -217,7 +217,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/_version.py index 5a163c0afedc..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" \ No newline at end of file +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/__init__.py index a5c3d2414cfd..ee2b940bd4fc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/_configuration.py index 3a595612bb8b..296b2906d2ac 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/_storage_management_client.py index ccfc5e9b23db..7b47d950780b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -41,11 +42,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -222,7 +222,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/__init__.py index bbce85749d18..a0549517e087 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/__init__.py @@ -5,30 +5,36 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._local_users_operations import LocalUsersOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._local_users_operations import LocalUsersOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -53,5 +59,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_blob_containers_operations.py index 38c5c5fc5bd3..08a01ee1211e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_containers_operations import ( build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, @@ -52,7 +65,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -117,7 +130,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -139,7 +152,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -155,7 +167,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -290,7 +301,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_09_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -325,7 +336,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -339,11 +349,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -453,7 +459,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_09_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -488,7 +494,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -502,7 +507,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -531,7 +536,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_09_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -554,7 +559,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -568,7 +572,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -576,9 +580,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -597,7 +599,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -620,7 +622,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -743,7 +744,7 @@ async def set_legal_hold( :rtype: ~azure.mgmt.storage.v2021_09_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -778,7 +779,6 @@ async def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -792,7 +792,7 @@ async def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -902,7 +902,7 @@ async def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2021_09_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -937,7 +937,6 @@ async def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -951,7 +950,7 @@ async def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1078,7 +1077,7 @@ async def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1119,7 +1118,6 @@ async def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1136,7 +1134,7 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1175,7 +1173,7 @@ async def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1201,7 +1199,6 @@ async def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1218,7 +1215,7 @@ async def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1254,7 +1251,7 @@ async def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1280,7 +1277,6 @@ async def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1297,7 +1293,7 @@ async def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1331,7 +1327,7 @@ async def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1355,7 +1351,6 @@ async def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1372,7 +1367,7 @@ async def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1502,7 +1497,7 @@ async def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1541,7 +1536,6 @@ async def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1558,7 +1552,7 @@ async def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1668,7 +1662,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2021_09_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1706,7 +1700,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1720,17 +1713,17 @@ async def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _object_level_worm_initial( # pylint: disable=inconsistent-return-statements + async def _object_level_worm_initial( self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1742,7 +1735,7 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_object_level_worm_request( resource_group_name=resource_group_name, @@ -1753,10 +1746,10 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1764,11 +1757,19 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_object_level_worm( @@ -1804,7 +1805,7 @@ async def begin_object_level_worm( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._object_level_worm_initial( # type: ignore + raw_result = await self._object_level_worm_initial( resource_group_name=resource_group_name, account_name=account_name, container_name=container_name, @@ -1814,6 +1815,7 @@ async def begin_object_level_worm( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_blob_inventory_policies_operations.py index 68a809bc29b4..a9724905c9ea 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_inventory_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_09_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,7 +110,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -127,7 +123,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -231,7 +227,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2021_09_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -266,7 +262,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -280,7 +275,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -288,7 +283,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -312,7 +307,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -335,7 +330,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -376,7 +370,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -395,7 +389,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -411,7 +404,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_blob_services_operations.py index 81c0346fdada..e7c191bbdb22 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_services_operations import ( build_get_service_properties_request, build_list_request, @@ -39,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +86,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -241,7 +236,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_09_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -277,7 +272,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -291,7 +285,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -316,7 +310,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_09_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -340,7 +334,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +347,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_deleted_accounts_operations.py index a97076c46e36..1d2273f44d8b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,21 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_accounts_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DeletedAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +88,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -107,7 +103,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -149,7 +144,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> :rtype: ~azure.mgmt.storage.v2021_09_01.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +166,6 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -186,7 +180,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_encryption_scopes_operations.py index 2d972ae01381..8bda1698ae93 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._encryption_scopes_operations import ( build_get_request, build_list_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -173,7 +170,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2021_09_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +205,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -223,11 +219,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +329,7 @@ async def patch( :rtype: ~azure.mgmt.storage.v2021_09_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +364,6 @@ async def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -387,7 +378,7 @@ async def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -416,7 +407,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_09_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -439,7 +430,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -454,7 +444,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -485,7 +475,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +494,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -520,7 +509,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_file_services_operations.py index cc55c8c871b6..9fb538460fe6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2021_09_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -207,7 +203,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_09_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +239,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -257,7 +252,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -282,7 +277,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_09_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +301,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -320,7 +314,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_file_shares_operations.py index bfeeffd6da12..7aa4edefb45a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_file_shares_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_shares_operations import ( build_create_request, build_delete_request, @@ -43,7 +40,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -108,7 +105,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -130,7 +127,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -146,7 +142,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -293,7 +288,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_09_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -329,7 +324,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -343,11 +337,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -457,7 +447,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_09_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -492,7 +482,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -506,7 +495,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -547,7 +536,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_09_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -572,7 +561,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -586,7 +574,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -594,7 +582,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -631,7 +619,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -656,7 +644,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -674,7 +661,7 @@ async def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -709,7 +696,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -744,7 +731,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -772,7 +759,7 @@ async def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -807,7 +794,6 @@ async def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -939,7 +925,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2021_09_01.models.LeaseShareResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -978,7 +964,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -995,7 +980,7 @@ async def lease( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("LeaseShareResponse", pipeline_response) + deserialized = self._deserialize("LeaseShareResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_local_users_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_local_users_operations.py index d67d67b9a0fd..0374432a6d12 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_local_users_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_local_users_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._local_users_operations import ( build_create_or_update_request, build_delete_request, @@ -42,7 +39,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +86,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.LocalUsers] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -172,7 +167,7 @@ async def get(self, resource_group_name: str, account_name: str, username: str, :rtype: ~azure.mgmt.storage.v2021_09_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -195,7 +190,6 @@ async def get(self, resource_group_name: str, account_name: str, username: str, headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -210,7 +204,7 @@ async def get(self, resource_group_name: str, account_name: str, username: str, error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -311,7 +305,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2021_09_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +340,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -361,7 +354,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -369,9 +362,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, username: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, username: str, **kwargs: Any) -> None: """Deletes the local user associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -388,7 +379,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,7 +402,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -449,7 +439,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2021_09_01.models.LocalUserKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -472,7 +462,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -487,7 +476,7 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserKeys", pipeline_response) + deserialized = self._deserialize("LocalUserKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -514,7 +503,7 @@ async def regenerate_password( :rtype: ~azure.mgmt.storage.v2021_09_01.models.LocalUserRegeneratePasswordResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -537,7 +526,6 @@ async def regenerate_password( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -552,7 +540,7 @@ async def regenerate_password( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response) + deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_management_policies_operations.py index e66c4ac5d7ba..a05cc2292abe 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._management_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +119,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -227,7 +223,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -262,7 +258,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -276,7 +271,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -284,7 +279,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -308,7 +303,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +326,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_object_replication_policies_operations.py index d4b6d7185f59..96b66a037004 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._object_replication_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -177,7 +172,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -200,7 +195,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +209,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -325,7 +319,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -360,7 +354,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -375,7 +368,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -383,7 +376,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, object_replication_policy_id: str, **kwargs: Any ) -> None: """Deletes the object replication policy associated with the specified storage account. @@ -404,7 +397,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +420,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_operations.py index 247ff2b3db50..70a7f9f40c70 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_private_endpoint_connections_operations.py index c9f112ab935a..499349d848b8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connections_operations import ( build_delete_request, build_get_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -174,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_09_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -197,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -212,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -313,7 +307,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2021_09_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +342,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -363,7 +356,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -371,7 +364,7 @@ async def put( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: """Deletes the specified private endpoint connection associated with the storage account. @@ -390,7 +383,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -413,7 +406,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_private_link_resources_operations.py index 3a41dcd4beff..9739c7078cb9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_by_storage_account_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ async def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2021_09_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,7 +92,6 @@ async def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +105,7 @@ async def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_queue_operations.py index 8de4144ea38c..728fe7b6e7a3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_operations import ( build_create_request, build_delete_request, @@ -41,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -166,7 +163,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_09_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -322,7 +318,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_09_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -357,7 +353,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -371,7 +366,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -400,7 +395,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2021_09_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +418,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -437,7 +431,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -445,9 +439,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any) -> None: """Deletes the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -466,7 +458,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -489,7 +481,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -541,7 +532,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -562,7 +553,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -578,7 +568,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_queue_services_operations.py index 97da5387c0a5..320c73e085ab 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2021_09_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -207,7 +203,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_09_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +239,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -257,7 +252,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -282,7 +277,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_09_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +301,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -320,7 +314,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_skus_operations.py index 60b5178ce934..b4c452394a3d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -90,7 +87,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -106,7 +102,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_storage_accounts_operations.py index be274d2086a3..51e93783120a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_abort_hierarchical_namespace_migration_request, build_check_name_availability_request, @@ -54,7 +67,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -137,7 +150,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2021_09_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -169,7 +182,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -183,7 +195,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -196,8 +208,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -210,7 +222,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -231,10 +243,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -242,12 +254,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -373,10 +387,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -399,9 +414,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -415,7 +428,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -437,7 +450,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -482,7 +494,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2021_09_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -505,7 +517,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -519,7 +530,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -630,7 +641,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_09_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -664,7 +675,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -678,7 +688,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -701,7 +711,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -718,7 +728,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -734,7 +743,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -784,7 +792,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -802,7 +810,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -818,7 +825,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -868,7 +874,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2021_09_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -891,7 +897,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -905,7 +910,7 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -999,7 +1004,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2021_09_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1033,7 +1038,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1047,7 +1051,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1138,7 +1142,7 @@ async def list_account_sas( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1172,7 +1176,6 @@ async def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1186,7 +1189,7 @@ async def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1275,7 +1278,7 @@ async def list_service_sas( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1309,7 +1312,6 @@ async def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1323,17 +1325,17 @@ async def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _failover_initial( # pylint: disable=inconsistent-return-statements + async def _failover_initial( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1345,7 +1347,7 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1355,10 +1357,10 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1366,11 +1368,19 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1398,7 +1408,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._failover_initial( # type: ignore + raw_result = await self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1407,6 +1417,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1430,10 +1441,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, request_type: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1445,7 +1456,7 @@ async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -1456,10 +1467,10 @@ async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1467,12 +1478,20 @@ async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_hierarchical_namespace_migration( @@ -1505,7 +1524,7 @@ async def begin_hierarchical_namespace_migration( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._hierarchical_namespace_migration_initial( # type: ignore + raw_result = await self._hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, request_type=request_type, @@ -1515,6 +1534,7 @@ async def begin_hierarchical_namespace_migration( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1538,10 +1558,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1553,7 +1573,7 @@ async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=in _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_abort_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -1563,10 +1583,10 @@ async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=in headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1574,12 +1594,20 @@ async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-long @@ -1607,7 +1635,7 @@ async def begin_abort_hierarchical_namespace_migration( # pylint: disable=name- lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._abort_hierarchical_namespace_migration_initial( # type: ignore + raw_result = await self._abort_hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1616,6 +1644,7 @@ async def begin_abort_hierarchical_namespace_migration( # pylint: disable=name- params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1645,8 +1674,8 @@ async def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1659,7 +1688,7 @@ async def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1680,10 +1709,10 @@ async def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1691,14 +1720,14 @@ async def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1814,10 +1843,11 @@ async def begin_restore_blob_ranges( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1842,9 +1872,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def revoke_user_delegation_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1858,7 +1886,7 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1880,7 +1908,6 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_table_operations.py index 2f7837056403..af922ed44dcd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_operations import ( build_create_request, build_delete_request, @@ -41,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -163,7 +160,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2021_09_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -319,7 +315,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2021_09_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -357,7 +353,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -371,7 +366,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -397,7 +392,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str :rtype: ~azure.mgmt.storage.v2021_09_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -420,7 +415,6 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -434,7 +428,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -442,9 +436,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any) -> None: """Deletes the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -462,7 +454,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -485,7 +477,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -523,7 +514,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -542,7 +533,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -558,7 +548,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_table_services_operations.py index 289f7616738e..5b0793ca1684 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2021_09_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -207,7 +203,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_09_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +239,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -257,7 +252,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -282,7 +277,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_09_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +301,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -320,7 +314,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_usages_operations.py index 46a350ed798c..61765eb052c9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/aio/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usages_operations import build_list_by_location_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +72,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_mode api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -109,7 +105,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/models/__init__.py index 9f9db63bf9f0..dbdcdf7988f2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/models/__init__.py @@ -5,222 +5,233 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccessPolicy -from ._models_py3 import AccountImmutabilityPolicyProperties -from ._models_py3 import AccountSasParameters -from ._models_py3 import ActiveDirectoryProperties -from ._models_py3 import AzureEntityResource -from ._models_py3 import AzureFilesIdentityBasedAuthentication -from ._models_py3 import BlobContainer -from ._models_py3 import BlobInventoryPolicy -from ._models_py3 import BlobInventoryPolicyDefinition -from ._models_py3 import BlobInventoryPolicyFilter -from ._models_py3 import BlobInventoryPolicyRule -from ._models_py3 import BlobInventoryPolicySchema -from ._models_py3 import BlobRestoreParameters -from ._models_py3 import BlobRestoreRange -from ._models_py3 import BlobRestoreStatus -from ._models_py3 import BlobServiceItems -from ._models_py3 import BlobServiceProperties -from ._models_py3 import ChangeFeed -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CloudErrorBody -from ._models_py3 import CorsRule -from ._models_py3 import CorsRules -from ._models_py3 import CustomDomain -from ._models_py3 import DateAfterCreation -from ._models_py3 import DateAfterModification -from ._models_py3 import DeleteRetentionPolicy -from ._models_py3 import DeletedAccount -from ._models_py3 import DeletedAccountListResult -from ._models_py3 import DeletedShare -from ._models_py3 import Dimension -from ._models_py3 import Encryption -from ._models_py3 import EncryptionIdentity -from ._models_py3 import EncryptionScope -from ._models_py3 import EncryptionScopeKeyVaultProperties -from ._models_py3 import EncryptionScopeListResult -from ._models_py3 import EncryptionService -from ._models_py3 import EncryptionServices -from ._models_py3 import Endpoints -from ._models_py3 import ErrorResponse -from ._models_py3 import ErrorResponseBody -from ._models_py3 import ExtendedLocation -from ._models_py3 import FileServiceItems -from ._models_py3 import FileServiceProperties -from ._models_py3 import FileShare -from ._models_py3 import FileShareItem -from ._models_py3 import FileShareItems -from ._models_py3 import GeoReplicationStats -from ._models_py3 import IPRule -from ._models_py3 import Identity -from ._models_py3 import ImmutabilityPolicy -from ._models_py3 import ImmutabilityPolicyProperties -from ._models_py3 import ImmutableStorageAccount -from ._models_py3 import ImmutableStorageWithVersioning -from ._models_py3 import KeyCreationTime -from ._models_py3 import KeyPolicy -from ._models_py3 import KeyVaultProperties -from ._models_py3 import LastAccessTimeTrackingPolicy -from ._models_py3 import LeaseContainerRequest -from ._models_py3 import LeaseContainerResponse -from ._models_py3 import LeaseShareRequest -from ._models_py3 import LeaseShareResponse -from ._models_py3 import LegalHold -from ._models_py3 import LegalHoldProperties -from ._models_py3 import ListAccountSasResponse -from ._models_py3 import ListBlobInventoryPolicy -from ._models_py3 import ListContainerItem -from ._models_py3 import ListContainerItems -from ._models_py3 import ListQueue -from ._models_py3 import ListQueueResource -from ._models_py3 import ListQueueServices -from ._models_py3 import ListServiceSasResponse -from ._models_py3 import ListTableResource -from ._models_py3 import ListTableServices -from ._models_py3 import LocalUser -from ._models_py3 import LocalUserKeys -from ._models_py3 import LocalUserRegeneratePasswordResult -from ._models_py3 import LocalUsers -from ._models_py3 import ManagementPolicy -from ._models_py3 import ManagementPolicyAction -from ._models_py3 import ManagementPolicyBaseBlob -from ._models_py3 import ManagementPolicyDefinition -from ._models_py3 import ManagementPolicyFilter -from ._models_py3 import ManagementPolicyRule -from ._models_py3 import ManagementPolicySchema -from ._models_py3 import ManagementPolicySnapShot -from ._models_py3 import ManagementPolicyVersion -from ._models_py3 import MetricSpecification -from ._models_py3 import Multichannel -from ._models_py3 import NetworkRuleSet -from ._models_py3 import ObjectReplicationPolicies -from ._models_py3 import ObjectReplicationPolicy -from ._models_py3 import ObjectReplicationPolicyFilter -from ._models_py3 import ObjectReplicationPolicyRule -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import PermissionScope -from ._models_py3 import PrivateEndpoint -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionListResult -from ._models_py3 import PrivateLinkResource -from ._models_py3 import PrivateLinkResourceListResult -from ._models_py3 import PrivateLinkServiceConnectionState -from ._models_py3 import ProtectedAppendWritesHistory -from ._models_py3 import ProtocolSettings -from ._models_py3 import ProxyResource -from ._models_py3 import QueueServiceProperties -from ._models_py3 import Resource -from ._models_py3 import ResourceAccessRule -from ._models_py3 import RestorePolicyProperties -from ._models_py3 import Restriction -from ._models_py3 import RoutingPreference -from ._models_py3 import SKUCapability -from ._models_py3 import SasPolicy -from ._models_py3 import ServiceSasParameters -from ._models_py3 import ServiceSpecification -from ._models_py3 import SignedIdentifier -from ._models_py3 import Sku -from ._models_py3 import SkuInformation -from ._models_py3 import SmbSetting -from ._models_py3 import SshPublicKey -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountInternetEndpoints -from ._models_py3 import StorageAccountKey -from ._models_py3 import StorageAccountListKeysResult -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountMicrosoftEndpoints -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountSkuConversionStatus -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import StorageQueue -from ._models_py3 import StorageSkuListResult -from ._models_py3 import SystemData -from ._models_py3 import Table -from ._models_py3 import TableAccessPolicy -from ._models_py3 import TableServiceProperties -from ._models_py3 import TableSignedIdentifier -from ._models_py3 import TagFilter -from ._models_py3 import TagProperty -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateHistoryProperty -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName -from ._models_py3 import UserAssignedIdentity -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._storage_management_client_enums import AccessTier -from ._storage_management_client_enums import AccountImmutabilityPolicyState -from ._storage_management_client_enums import AccountStatus -from ._storage_management_client_enums import ActiveDirectoryPropertiesAccountType -from ._storage_management_client_enums import AllowedCopyScope -from ._storage_management_client_enums import BlobInventoryPolicyName -from ._storage_management_client_enums import BlobRestoreProgressStatus -from ._storage_management_client_enums import Bypass -from ._storage_management_client_enums import CorsRuleAllowedMethodsItem -from ._storage_management_client_enums import CreatedByType -from ._storage_management_client_enums import DefaultAction -from ._storage_management_client_enums import DefaultSharePermission -from ._storage_management_client_enums import DirectoryServiceOptions -from ._storage_management_client_enums import DnsEndpointType -from ._storage_management_client_enums import EnabledProtocols -from ._storage_management_client_enums import EncryptionScopeSource -from ._storage_management_client_enums import EncryptionScopeState -from ._storage_management_client_enums import ExpirationAction -from ._storage_management_client_enums import ExtendedLocationTypes -from ._storage_management_client_enums import Format -from ._storage_management_client_enums import GeoReplicationStatus -from ._storage_management_client_enums import HttpProtocol -from ._storage_management_client_enums import IdentityType -from ._storage_management_client_enums import ImmutabilityPolicyState -from ._storage_management_client_enums import ImmutabilityPolicyUpdateType -from ._storage_management_client_enums import InventoryRuleType -from ._storage_management_client_enums import KeyPermission -from ._storage_management_client_enums import KeySource -from ._storage_management_client_enums import KeyType -from ._storage_management_client_enums import Kind -from ._storage_management_client_enums import LargeFileSharesState -from ._storage_management_client_enums import LeaseContainerRequestAction -from ._storage_management_client_enums import LeaseDuration -from ._storage_management_client_enums import LeaseShareAction -from ._storage_management_client_enums import LeaseState -from ._storage_management_client_enums import LeaseStatus -from ._storage_management_client_enums import ListContainersInclude -from ._storage_management_client_enums import ManagementPolicyName -from ._storage_management_client_enums import MigrationState -from ._storage_management_client_enums import MinimumTlsVersion -from ._storage_management_client_enums import Name -from ._storage_management_client_enums import ObjectType -from ._storage_management_client_enums import Permissions -from ._storage_management_client_enums import PrivateEndpointConnectionProvisioningState -from ._storage_management_client_enums import PrivateEndpointServiceConnectionStatus -from ._storage_management_client_enums import ProvisioningState -from ._storage_management_client_enums import PublicAccess -from ._storage_management_client_enums import PublicNetworkAccess -from ._storage_management_client_enums import Reason -from ._storage_management_client_enums import ReasonCode -from ._storage_management_client_enums import RootSquashType -from ._storage_management_client_enums import RoutingChoice -from ._storage_management_client_enums import RuleType -from ._storage_management_client_enums import Schedule -from ._storage_management_client_enums import Services -from ._storage_management_client_enums import ShareAccessTier -from ._storage_management_client_enums import SignedResource -from ._storage_management_client_enums import SignedResourceTypes -from ._storage_management_client_enums import SkuConversionStatus -from ._storage_management_client_enums import SkuName -from ._storage_management_client_enums import SkuTier -from ._storage_management_client_enums import State -from ._storage_management_client_enums import StorageAccountExpand -from ._storage_management_client_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccessPolicy, + AccountImmutabilityPolicyProperties, + AccountSasParameters, + ActiveDirectoryProperties, + AzureEntityResource, + AzureFilesIdentityBasedAuthentication, + BlobContainer, + BlobInventoryPolicy, + BlobInventoryPolicyDefinition, + BlobInventoryPolicyFilter, + BlobInventoryPolicyRule, + BlobInventoryPolicySchema, + BlobRestoreParameters, + BlobRestoreRange, + BlobRestoreStatus, + BlobServiceItems, + BlobServiceProperties, + ChangeFeed, + CheckNameAvailabilityResult, + CloudErrorBody, + CorsRule, + CorsRules, + CustomDomain, + DateAfterCreation, + DateAfterModification, + DeleteRetentionPolicy, + DeletedAccount, + DeletedAccountListResult, + DeletedShare, + Dimension, + Encryption, + EncryptionIdentity, + EncryptionScope, + EncryptionScopeKeyVaultProperties, + EncryptionScopeListResult, + EncryptionService, + EncryptionServices, + Endpoints, + ErrorResponse, + ErrorResponseBody, + ExtendedLocation, + FileServiceItems, + FileServiceProperties, + FileShare, + FileShareItem, + FileShareItems, + GeoReplicationStats, + IPRule, + Identity, + ImmutabilityPolicy, + ImmutabilityPolicyProperties, + ImmutableStorageAccount, + ImmutableStorageWithVersioning, + KeyCreationTime, + KeyPolicy, + KeyVaultProperties, + LastAccessTimeTrackingPolicy, + LeaseContainerRequest, + LeaseContainerResponse, + LeaseShareRequest, + LeaseShareResponse, + LegalHold, + LegalHoldProperties, + ListAccountSasResponse, + ListBlobInventoryPolicy, + ListContainerItem, + ListContainerItems, + ListQueue, + ListQueueResource, + ListQueueServices, + ListServiceSasResponse, + ListTableResource, + ListTableServices, + LocalUser, + LocalUserKeys, + LocalUserRegeneratePasswordResult, + LocalUsers, + ManagementPolicy, + ManagementPolicyAction, + ManagementPolicyBaseBlob, + ManagementPolicyDefinition, + ManagementPolicyFilter, + ManagementPolicyRule, + ManagementPolicySchema, + ManagementPolicySnapShot, + ManagementPolicyVersion, + MetricSpecification, + Multichannel, + NetworkRuleSet, + ObjectReplicationPolicies, + ObjectReplicationPolicy, + ObjectReplicationPolicyFilter, + ObjectReplicationPolicyRule, + Operation, + OperationDisplay, + OperationListResult, + PermissionScope, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionListResult, + PrivateLinkResource, + PrivateLinkResourceListResult, + PrivateLinkServiceConnectionState, + ProtectedAppendWritesHistory, + ProtocolSettings, + ProxyResource, + QueueServiceProperties, + Resource, + ResourceAccessRule, + RestorePolicyProperties, + Restriction, + RoutingPreference, + SKUCapability, + SasPolicy, + ServiceSasParameters, + ServiceSpecification, + SignedIdentifier, + Sku, + SkuInformation, + SmbSetting, + SshPublicKey, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountInternetEndpoints, + StorageAccountKey, + StorageAccountListKeysResult, + StorageAccountListResult, + StorageAccountMicrosoftEndpoints, + StorageAccountRegenerateKeyParameters, + StorageAccountSkuConversionStatus, + StorageAccountUpdateParameters, + StorageQueue, + StorageSkuListResult, + SystemData, + Table, + TableAccessPolicy, + TableServiceProperties, + TableSignedIdentifier, + TagFilter, + TagProperty, + TrackedResource, + UpdateHistoryProperty, + Usage, + UsageListResult, + UsageName, + UserAssignedIdentity, + VirtualNetworkRule, +) + +from ._storage_management_client_enums import ( # type: ignore + AccessTier, + AccountImmutabilityPolicyState, + AccountStatus, + ActiveDirectoryPropertiesAccountType, + AllowedCopyScope, + BlobInventoryPolicyName, + BlobRestoreProgressStatus, + Bypass, + CorsRuleAllowedMethodsItem, + CreatedByType, + DefaultAction, + DefaultSharePermission, + DirectoryServiceOptions, + DnsEndpointType, + EnabledProtocols, + EncryptionScopeSource, + EncryptionScopeState, + ExpirationAction, + ExtendedLocationTypes, + Format, + GeoReplicationStatus, + HttpProtocol, + IdentityType, + ImmutabilityPolicyState, + ImmutabilityPolicyUpdateType, + InventoryRuleType, + KeyPermission, + KeySource, + KeyType, + Kind, + LargeFileSharesState, + LeaseContainerRequestAction, + LeaseDuration, + LeaseShareAction, + LeaseState, + LeaseStatus, + ListContainersInclude, + ManagementPolicyName, + MigrationState, + MinimumTlsVersion, + Name, + ObjectType, + Permissions, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProvisioningState, + PublicAccess, + PublicNetworkAccess, + Reason, + ReasonCode, + RootSquashType, + RoutingChoice, + RuleType, + Schedule, + Services, + ShareAccessTier, + SignedResource, + SignedResourceTypes, + SkuConversionStatus, + SkuName, + SkuTier, + State, + StorageAccountExpand, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -437,5 +448,5 @@ "StorageAccountExpand", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/models/_models_py3.py index 6a1d7b07dab9..73f1af3a088d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,7 +13,6 @@ from ... import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -444,7 +443,7 @@ def __init__( self.default_share_permission = default_share_permission -class BlobContainer(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class BlobContainer(AzureEntityResource): """Properties of the blob container, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -1111,7 +1110,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class BlobServiceProperties(Resource): # pylint: disable=too-many-instance-attributes +class BlobServiceProperties(Resource): """The properties of a storage account’s Blob service. Variables are only populated by the server, and will be ignored when sending a request. @@ -2432,7 +2431,7 @@ def __init__( self.protocol_settings = protocol_settings -class FileShare(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShare(AzureEntityResource): """Properties of the file share, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -2590,7 +2589,7 @@ def __init__( self.snapshot_time = None -class FileShareItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShareItem(AzureEntityResource): """The file share properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -3354,7 +3353,7 @@ class LeaseContainerRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2021_09_01.models.LeaseContainerRequestAction :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -3393,7 +3392,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2021_09_01.models.LeaseContainerRequestAction :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -3451,7 +3450,7 @@ class LeaseShareRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2021_09_01.models.LeaseShareAction :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -3490,7 +3489,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2021_09_01.models.LeaseShareAction :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -3688,7 +3687,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class ListContainerItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class ListContainerItem(AzureEntityResource): """The blob container properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -4056,7 +4055,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class LocalUser(Resource): # pylint: disable=too-many-instance-attributes +class LocalUser(Resource): """The local user associated with the storage accounts. Variables are only populated by the server, and will be ignored when sending a request. @@ -5654,7 +5653,7 @@ def __init__( self.expiration_action = expiration_action -class ServiceSasParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ServiceSasParameters(_serialization.Model): """The parameters to list service SAS credentials of a specific resource. All required parameters must be populated in order to send to server. @@ -6088,7 +6087,7 @@ class SshPublicKey(_serialization.Model): :ivar description: Optional. It is used to store the function/usage of the key. :vartype description: str - :ivar key: Ssh public key base64 encoded. The format should be: ':code:`` + :ivar key: Ssh public key base64 encoded. The format should be: '\\ :code:`` :code:``', e.g. ssh-rsa AAAABBBB. :vartype key: str """ @@ -6102,7 +6101,7 @@ def __init__(self, *, description: Optional[str] = None, key: Optional[str] = No """ :keyword description: Optional. It is used to store the function/usage of the key. :paramtype description: str - :keyword key: Ssh public key base64 encoded. The format should be: ':code:`` + :keyword key: Ssh public key base64 encoded. The format should be: '\\ :code:`` :code:``', e.g. ssh-rsa AAAABBBB. :paramtype key: str """ @@ -6160,7 +6159,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class StorageAccount(TrackedResource): # pylint: disable=too-many-instance-attributes +class StorageAccount(TrackedResource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. @@ -6580,7 +6579,7 @@ def __init__(self, *, name: str, **kwargs: Any) -> None: self.name = name -class StorageAccountCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountCreateParameters(_serialization.Model): """The parameters used when creating a storage account. All required parameters must be populated in order to send to server. @@ -7149,7 +7148,7 @@ def __init__(self, *, target_sku_name: Optional[Union[str, "_models.SkuName"]] = self.end_time = None -class StorageAccountUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountUpdateParameters(_serialization.Model): """The parameters that can be provided when updating the storage account properties. :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/models/_storage_management_client_enums.py index 93ca2cf7d001..c3e3e891adb6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/models/_storage_management_client_enums.py @@ -291,6 +291,7 @@ class LeaseContainerRequestAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" @@ -310,6 +311,7 @@ class LeaseShareAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/__init__.py index bbce85749d18..a0549517e087 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/__init__.py @@ -5,30 +5,36 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._local_users_operations import LocalUsersOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._local_users_operations import LocalUsersOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -53,5 +59,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_blob_containers_operations.py index 209cc2a90885..cb360b762479 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -649,7 +649,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -671,7 +671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -687,7 +686,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -822,7 +820,7 @@ def create( :rtype: ~azure.mgmt.storage.v2021_09_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -857,7 +855,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -871,11 +868,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -985,7 +978,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_09_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1020,7 +1013,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1034,7 +1026,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1063,7 +1055,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_09_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1086,7 +1078,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1100,7 +1091,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1129,7 +1120,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1152,7 +1143,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1275,7 +1265,7 @@ def set_legal_hold( :rtype: ~azure.mgmt.storage.v2021_09_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1310,7 +1300,6 @@ def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1324,7 +1313,7 @@ def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1434,7 +1423,7 @@ def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2021_09_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1469,7 +1458,6 @@ def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1483,7 +1471,7 @@ def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1610,7 +1598,7 @@ def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1651,7 +1639,6 @@ def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1668,7 +1655,7 @@ def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1707,7 +1694,7 @@ def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1733,7 +1720,6 @@ def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1750,7 +1736,7 @@ def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1786,7 +1772,7 @@ def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1812,7 +1798,6 @@ def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1829,7 +1814,7 @@ def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1863,7 +1848,7 @@ def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1887,7 +1872,6 @@ def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1904,7 +1888,7 @@ def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2034,7 +2018,7 @@ def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2073,7 +2057,6 @@ def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2090,7 +2073,7 @@ def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2200,7 +2183,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2021_09_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2238,7 +2221,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2252,17 +2234,17 @@ def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _object_level_worm_initial( # pylint: disable=inconsistent-return-statements + def _object_level_worm_initial( self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2274,7 +2256,7 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_object_level_worm_request( resource_group_name=resource_group_name, @@ -2285,10 +2267,10 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2296,11 +2278,19 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_object_level_worm( @@ -2336,7 +2326,7 @@ def begin_object_level_worm( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._object_level_worm_initial( # type: ignore + raw_result = self._object_level_worm_initial( resource_group_name=resource_group_name, account_name=account_name, container_name=container_name, @@ -2346,6 +2336,7 @@ def begin_object_level_worm( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_blob_inventory_policies_operations.py index dd313590bfa7..58f52c374197 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -235,7 +232,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_09_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +255,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -272,7 +268,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -376,7 +372,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2021_09_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,7 +407,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -425,7 +420,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -457,7 +452,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -480,7 +475,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -521,7 +515,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -540,7 +534,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -556,7 +549,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_blob_services_operations.py index 042cec48e32f..842d55c5617d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -191,7 +188,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -210,7 +207,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -226,7 +222,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -343,7 +338,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_09_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -379,7 +374,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -393,7 +387,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -418,7 +412,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_09_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -442,7 +436,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -456,7 +449,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_deleted_accounts_operations.py index 69b5cf3ff3be..32c663377e4c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -130,7 +127,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.DeletedAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -147,7 +144,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -163,7 +159,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -205,7 +200,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model :rtype: ~azure.mgmt.storage.v2021_09_01.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +222,6 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -242,7 +236,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_encryption_scopes_operations.py index e13665d292d8..b8454f161d8f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -315,7 +312,7 @@ def put( :rtype: ~azure.mgmt.storage.v2021_09_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -350,7 +347,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -365,11 +361,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -479,7 +471,7 @@ def patch( :rtype: ~azure.mgmt.storage.v2021_09_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -514,7 +506,6 @@ def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -529,7 +520,7 @@ def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -558,7 +549,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_09_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -581,7 +572,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -596,7 +586,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -624,7 +614,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -643,7 +633,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -659,7 +648,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_file_services_operations.py index f6259ae9f886..41797abdc392 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -179,7 +176,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2021_09_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -310,7 +306,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_09_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +342,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -360,7 +355,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -385,7 +380,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_09_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -409,7 +404,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -423,7 +417,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_file_shares_operations.py index 3a98c6c29da1..71298a25c7be 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_file_shares_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -401,7 +399,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +421,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -439,7 +436,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -586,7 +582,7 @@ def create( :rtype: ~azure.mgmt.storage.v2021_09_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -622,7 +618,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -636,11 +631,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -750,7 +741,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_09_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -785,7 +776,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -799,7 +789,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -840,7 +830,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_09_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -865,7 +855,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -879,7 +868,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -924,7 +913,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -949,7 +938,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -967,7 +955,7 @@ def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -1002,7 +990,7 @@ def restore( # pylint: disable=inconsistent-return-statements """ @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -1065,7 +1053,7 @@ def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1100,7 +1088,6 @@ def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1232,7 +1219,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2021_09_01.models.LeaseShareResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1271,7 +1258,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1288,7 +1274,7 @@ def lease( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("LeaseShareResponse", pipeline_response) + deserialized = self._deserialize("LeaseShareResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_local_users_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_local_users_operations.py index a5150ccb44d4..842b929bc66d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_local_users_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_local_users_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -287,7 +284,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.LocalUsers] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +303,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -322,7 +318,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -370,7 +365,7 @@ def get(self, resource_group_name: str, account_name: str, username: str, **kwar :rtype: ~azure.mgmt.storage.v2021_09_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -393,7 +388,6 @@ def get(self, resource_group_name: str, account_name: str, username: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -408,7 +402,7 @@ def get(self, resource_group_name: str, account_name: str, username: str, **kwar error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -509,7 +503,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2021_09_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -544,7 +538,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -559,7 +552,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -586,7 +579,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -609,7 +602,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -647,7 +639,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2021_09_01.models.LocalUserKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -670,7 +662,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -685,7 +676,7 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserKeys", pipeline_response) + deserialized = self._deserialize("LocalUserKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -712,7 +703,7 @@ def regenerate_password( :rtype: ~azure.mgmt.storage.v2021_09_01.models.LocalUserRegeneratePasswordResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -735,7 +726,6 @@ def regenerate_password( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -750,7 +740,7 @@ def regenerate_password( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response) + deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_management_policies_operations.py index 3cf3485ef2c2..de7cb5188f6d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -196,7 +193,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,7 +216,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -233,7 +229,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +333,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +368,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -386,7 +381,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -418,7 +413,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -441,7 +436,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_object_replication_policies_operations.py index d8a7f992fac5..c210d54e0712 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -229,7 +226,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -248,7 +245,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -264,7 +260,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -316,7 +311,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -339,7 +334,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +348,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +458,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +493,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -514,7 +507,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -543,7 +536,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +559,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_operations.py index 4ad3304f8b20..9cdc119e7e74 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -126,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_private_endpoint_connections_operations.py index 0e2d96ed4a36..97ef96351437 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -241,7 +238,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,7 +257,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -276,7 +272,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -325,7 +320,7 @@ def get( :rtype: ~azure.mgmt.storage.v2021_09_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +343,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -363,7 +357,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +458,7 @@ def put( :rtype: ~azure.mgmt.storage.v2021_09_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +493,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -514,7 +507,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -541,7 +534,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -564,7 +557,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_private_link_resources_operations.py index 0bf85a44dfdb..4fe9998a913d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -109,7 +106,7 @@ def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2021_09_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -131,7 +128,6 @@ def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -145,7 +141,7 @@ def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_queue_operations.py index 10ce809484c5..95e1c9d46e7f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -375,7 +372,7 @@ def create( :rtype: ~azure.mgmt.storage.v2021_09_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -410,7 +407,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -424,7 +420,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -531,7 +527,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_09_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +562,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -580,7 +575,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -607,7 +602,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw :rtype: ~azure.mgmt.storage.v2021_09_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -630,7 +625,6 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -644,7 +638,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -673,7 +667,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -696,7 +690,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -747,7 +740,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -768,7 +761,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -784,7 +776,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_queue_services_operations.py index 33f4e71e780a..a4e854aad0e6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -179,7 +176,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2021_09_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -310,7 +306,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_09_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +342,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -360,7 +355,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -385,7 +380,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_09_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -409,7 +404,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -423,7 +417,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_skus_operations.py index 8fc4602cd48e..6703981a69dd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_storage_accounts_operations.py index 112c1a494053..4913a6e35002 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -649,7 +649,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2021_09_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -681,7 +681,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -695,7 +694,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -708,8 +707,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -722,7 +721,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -743,10 +742,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -754,12 +753,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -882,10 +883,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -924,7 +926,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -946,7 +948,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -991,7 +992,7 @@ def get_properties( :rtype: ~azure.mgmt.storage.v2021_09_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1014,7 +1015,6 @@ def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1028,7 +1028,7 @@ def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1139,7 +1139,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_09_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1173,7 +1173,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1187,7 +1186,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1209,7 +1208,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1226,7 +1225,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1242,7 +1240,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1289,7 +1286,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1307,7 +1304,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1323,7 +1319,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1373,7 +1368,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2021_09_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1396,7 +1391,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1410,7 +1404,7 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1504,7 +1498,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2021_09_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1538,7 +1532,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1552,7 +1545,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1643,7 +1636,7 @@ def list_account_sas( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1677,7 +1670,6 @@ def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1691,7 +1683,7 @@ def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1780,7 +1772,7 @@ def list_service_sas( :rtype: ~azure.mgmt.storage.v2021_09_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1814,7 +1806,6 @@ def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1828,17 +1819,15 @@ def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _failover_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _failover_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1850,7 +1839,7 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1860,10 +1849,10 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1871,11 +1860,19 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1903,7 +1900,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._failover_initial( # type: ignore + raw_result = self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1912,6 +1909,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1935,10 +1933,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, request_type: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1950,7 +1948,7 @@ def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-r _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -1961,10 +1959,10 @@ def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1972,12 +1970,20 @@ def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_hierarchical_namespace_migration( @@ -2010,7 +2016,7 @@ def begin_hierarchical_namespace_migration( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._hierarchical_namespace_migration_initial( # type: ignore + raw_result = self._hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, request_type=request_type, @@ -2020,6 +2026,7 @@ def begin_hierarchical_namespace_migration( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2043,10 +2050,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _abort_hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2058,7 +2065,7 @@ def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_abort_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -2068,10 +2075,10 @@ def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2079,12 +2086,20 @@ def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-long @@ -2112,7 +2127,7 @@ def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-lo lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._abort_hierarchical_namespace_migration_initial( # type: ignore + raw_result = self._abort_hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -2121,6 +2136,7 @@ def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-lo params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2150,8 +2166,8 @@ def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2164,7 +2180,7 @@ def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2185,10 +2201,10 @@ def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2196,14 +2212,14 @@ def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2316,10 +2332,11 @@ def begin_restore_blob_ranges( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2360,7 +2377,7 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2382,7 +2399,6 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_table_operations.py index 56741a11ca37..60bf1fafd4c9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -340,7 +337,7 @@ def create( :rtype: ~azure.mgmt.storage.v2021_09_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -378,7 +375,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -392,7 +388,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -496,7 +492,7 @@ def update( :rtype: ~azure.mgmt.storage.v2021_09_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -534,7 +530,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -548,7 +543,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -574,7 +569,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw :rtype: ~azure.mgmt.storage.v2021_09_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -597,7 +592,6 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -611,7 +605,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -639,7 +633,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -662,7 +656,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -700,7 +693,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -719,7 +712,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -735,7 +727,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_table_services_operations.py index 9816b0dd3178..3b7ca8341cb1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -179,7 +176,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2021_09_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -310,7 +306,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2021_09_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +342,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -360,7 +355,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -385,7 +380,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2021_09_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -409,7 +404,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -423,7 +417,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_usages_operations.py index 5e4e909bde19..3d10c2e7058f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_09_01/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -105,7 +102,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.Us api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-09-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -139,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/__init__.py index a860a5c185c9..60980065e1ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/_configuration.py index f9bfd4854fd0..7316bb72f911 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/_metadata.json index 853cb69db687..b770cf897224 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/_storage_management_client.py index cdeb4bbef0b5..5dfd90c0ee0a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -41,11 +42,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -217,7 +217,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/_version.py index 5a163c0afedc..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" \ No newline at end of file +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/__init__.py index a5c3d2414cfd..ee2b940bd4fc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/_configuration.py index bc246da8db27..466dd0d44ebb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/_storage_management_client.py index 990dfb884a7d..d6d1dc9b90bb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -41,11 +42,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -222,7 +222,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/__init__.py index bbce85749d18..a0549517e087 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/__init__.py @@ -5,30 +5,36 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._local_users_operations import LocalUsersOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._local_users_operations import LocalUsersOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -53,5 +59,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_blob_containers_operations.py index ad39f21eb91d..09a4a8ee81a0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_containers_operations import ( build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, @@ -52,7 +65,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -117,7 +130,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -139,7 +152,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -155,7 +167,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -290,7 +301,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2022_05_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -325,7 +336,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -339,11 +349,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -453,7 +459,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2022_05_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -488,7 +494,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -502,7 +507,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -531,7 +536,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2022_05_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -554,7 +559,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -568,7 +572,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -576,9 +580,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -597,7 +599,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -620,7 +622,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -743,7 +744,7 @@ async def set_legal_hold( :rtype: ~azure.mgmt.storage.v2022_05_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -778,7 +779,6 @@ async def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -792,7 +792,7 @@ async def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -902,7 +902,7 @@ async def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2022_05_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -937,7 +937,6 @@ async def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -951,7 +950,7 @@ async def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1078,7 +1077,7 @@ async def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1119,7 +1118,6 @@ async def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1136,7 +1134,7 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1175,7 +1173,7 @@ async def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1201,7 +1199,6 @@ async def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1218,7 +1215,7 @@ async def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1254,7 +1251,7 @@ async def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1280,7 +1277,6 @@ async def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1297,7 +1293,7 @@ async def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1331,7 +1327,7 @@ async def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1355,7 +1351,6 @@ async def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1372,7 +1367,7 @@ async def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1502,7 +1497,7 @@ async def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1541,7 +1536,6 @@ async def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1558,7 +1552,7 @@ async def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1668,7 +1662,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2022_05_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1706,7 +1700,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1720,17 +1713,17 @@ async def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _object_level_worm_initial( # pylint: disable=inconsistent-return-statements + async def _object_level_worm_initial( self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1742,7 +1735,7 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_object_level_worm_request( resource_group_name=resource_group_name, @@ -1753,10 +1746,10 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1764,11 +1757,19 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_object_level_worm( @@ -1804,7 +1805,7 @@ async def begin_object_level_worm( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._object_level_worm_initial( # type: ignore + raw_result = await self._object_level_worm_initial( resource_group_name=resource_group_name, account_name=account_name, container_name=container_name, @@ -1814,6 +1815,7 @@ async def begin_object_level_worm( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_blob_inventory_policies_operations.py index 9cec7838b2cf..c566e318aafd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_inventory_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2022_05_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,7 +110,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -127,7 +123,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -231,7 +227,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2022_05_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -266,7 +262,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -280,7 +275,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -288,7 +283,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -312,7 +307,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -335,7 +330,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -376,7 +370,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -395,7 +389,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -411,7 +404,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_blob_services_operations.py index b02a03c8a40e..11ba7631c4c4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_services_operations import ( build_get_service_properties_request, build_list_request, @@ -39,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +86,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -241,7 +236,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2022_05_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -277,7 +272,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -291,7 +285,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -316,7 +310,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2022_05_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -340,7 +334,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +347,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_deleted_accounts_operations.py index f4b18001f4d4..e4936a26ba2b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,21 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_accounts_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DeletedAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +88,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -107,7 +103,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -149,7 +144,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> :rtype: ~azure.mgmt.storage.v2022_05_01.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +166,6 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -186,7 +180,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_encryption_scopes_operations.py index f1bd39ee6a26..6e20cb3028ca 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._encryption_scopes_operations import ( build_get_request, build_list_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -173,7 +170,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2022_05_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +205,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -223,11 +219,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +329,7 @@ async def patch( :rtype: ~azure.mgmt.storage.v2022_05_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +364,6 @@ async def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -387,7 +378,7 @@ async def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -416,7 +407,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2022_05_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -439,7 +430,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -454,7 +444,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -485,7 +475,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +494,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -520,7 +509,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_file_services_operations.py index f144691d10a1..93b940cad88a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2022_05_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -207,7 +203,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2022_05_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +239,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -257,7 +252,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -282,7 +277,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2022_05_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +301,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -320,7 +314,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_file_shares_operations.py index 3659cf6d0800..29dab3d980f5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_file_shares_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_shares_operations import ( build_create_request, build_delete_request, @@ -43,7 +40,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -108,7 +105,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -130,7 +127,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -146,7 +142,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -293,7 +288,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2022_05_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -329,7 +324,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -343,11 +337,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -457,7 +447,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2022_05_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -492,7 +482,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -506,7 +495,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -547,7 +536,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2022_05_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -572,7 +561,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -586,7 +574,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -594,7 +582,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -631,7 +619,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -656,7 +644,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -674,7 +661,7 @@ async def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -709,7 +696,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -744,7 +731,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -772,7 +759,7 @@ async def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -807,7 +794,6 @@ async def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -939,7 +925,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2022_05_01.models.LeaseShareResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -978,7 +964,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -995,7 +980,7 @@ async def lease( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("LeaseShareResponse", pipeline_response) + deserialized = self._deserialize("LeaseShareResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_local_users_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_local_users_operations.py index eeded3cc73cb..ffe8dcd63940 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_local_users_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_local_users_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._local_users_operations import ( build_create_or_update_request, build_delete_request, @@ -42,7 +39,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +86,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.LocalUsers] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -172,7 +167,7 @@ async def get(self, resource_group_name: str, account_name: str, username: str, :rtype: ~azure.mgmt.storage.v2022_05_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -195,7 +190,6 @@ async def get(self, resource_group_name: str, account_name: str, username: str, headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -210,7 +204,7 @@ async def get(self, resource_group_name: str, account_name: str, username: str, error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -311,7 +305,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2022_05_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +340,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -361,7 +354,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -369,9 +362,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, username: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, username: str, **kwargs: Any) -> None: """Deletes the local user associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -388,7 +379,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,7 +402,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -449,7 +439,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2022_05_01.models.LocalUserKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -472,7 +462,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -487,7 +476,7 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserKeys", pipeline_response) + deserialized = self._deserialize("LocalUserKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -514,7 +503,7 @@ async def regenerate_password( :rtype: ~azure.mgmt.storage.v2022_05_01.models.LocalUserRegeneratePasswordResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -537,7 +526,6 @@ async def regenerate_password( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -552,7 +540,7 @@ async def regenerate_password( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response) + deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_management_policies_operations.py index 72e568d3a45c..e79b20883bc5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._management_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +119,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -227,7 +223,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -262,7 +258,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -276,7 +271,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -284,7 +279,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -308,7 +303,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +326,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_object_replication_policies_operations.py index 64703fa14e5f..8d592babbf5c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._object_replication_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -177,7 +172,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -200,7 +195,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +209,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -325,7 +319,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -360,7 +354,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -375,7 +368,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -383,7 +376,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, object_replication_policy_id: str, **kwargs: Any ) -> None: """Deletes the object replication policy associated with the specified storage account. @@ -404,7 +397,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +420,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_operations.py index 47139c92d877..099148d113e1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_private_endpoint_connections_operations.py index 1d18d641080d..741a6c67814f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connections_operations import ( build_delete_request, build_get_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -174,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2022_05_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -197,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -212,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -313,7 +307,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2022_05_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +342,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -363,7 +356,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -371,7 +364,7 @@ async def put( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: """Deletes the specified private endpoint connection associated with the storage account. @@ -390,7 +383,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -413,7 +406,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_private_link_resources_operations.py index 064c39590706..cb92ea293f2a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_by_storage_account_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ async def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2022_05_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,7 +92,6 @@ async def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +105,7 @@ async def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_queue_operations.py index 5e66d951b404..6b7af6f2ec51 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_operations import ( build_create_request, build_delete_request, @@ -41,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -166,7 +163,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2022_05_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -322,7 +318,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2022_05_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -357,7 +353,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -371,7 +366,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -400,7 +395,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2022_05_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +418,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -437,7 +431,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -445,9 +439,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any) -> None: """Deletes the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -466,7 +458,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -489,7 +481,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -541,7 +532,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -562,7 +553,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -578,7 +568,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_queue_services_operations.py index d1afb6fb371f..23d1d8b1f9c8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2022_05_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -207,7 +203,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2022_05_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +239,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -257,7 +252,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -282,7 +277,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2022_05_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +301,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -320,7 +314,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_skus_operations.py index 08e15f8e8d3d..c0c8afcb9f0c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -90,7 +87,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -106,7 +102,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_storage_accounts_operations.py index 738667fd1c8d..833d5a4a75b9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_abort_hierarchical_namespace_migration_request, build_check_name_availability_request, @@ -54,7 +67,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -137,7 +150,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2022_05_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -169,7 +182,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -183,7 +195,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -196,8 +208,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -210,7 +222,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -231,10 +243,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -242,12 +254,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -373,10 +387,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -399,9 +414,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -415,7 +428,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -437,7 +450,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -482,7 +494,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2022_05_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -505,7 +517,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -519,7 +530,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -630,7 +641,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2022_05_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -664,7 +675,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -678,7 +688,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -701,7 +711,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -718,7 +728,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -734,7 +743,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -784,7 +792,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -802,7 +810,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -818,7 +825,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -868,7 +874,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2022_05_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -891,7 +897,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -905,7 +910,7 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -999,7 +1004,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2022_05_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1033,7 +1038,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1047,7 +1051,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1138,7 +1142,7 @@ async def list_account_sas( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1172,7 +1176,6 @@ async def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1186,7 +1189,7 @@ async def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1275,7 +1278,7 @@ async def list_service_sas( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1309,7 +1312,6 @@ async def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1323,17 +1325,17 @@ async def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _failover_initial( # pylint: disable=inconsistent-return-statements + async def _failover_initial( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1345,7 +1347,7 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1355,10 +1357,10 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1366,11 +1368,19 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1398,7 +1408,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._failover_initial( # type: ignore + raw_result = await self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1407,6 +1417,7 @@ async def begin_failover(self, resource_group_name: str, account_name: str, **kw params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1430,10 +1441,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, request_type: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1445,7 +1456,7 @@ async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -1456,10 +1467,10 @@ async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1467,12 +1478,20 @@ async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_hierarchical_namespace_migration( @@ -1505,7 +1524,7 @@ async def begin_hierarchical_namespace_migration( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._hierarchical_namespace_migration_initial( # type: ignore + raw_result = await self._hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, request_type=request_type, @@ -1515,6 +1534,7 @@ async def begin_hierarchical_namespace_migration( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1538,10 +1558,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1553,7 +1573,7 @@ async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=in _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_abort_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -1563,10 +1583,10 @@ async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=in headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1574,12 +1594,20 @@ async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-long @@ -1607,7 +1635,7 @@ async def begin_abort_hierarchical_namespace_migration( # pylint: disable=name- lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._abort_hierarchical_namespace_migration_initial( # type: ignore + raw_result = await self._abort_hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1616,6 +1644,7 @@ async def begin_abort_hierarchical_namespace_migration( # pylint: disable=name- params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1645,8 +1674,8 @@ async def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1659,7 +1688,7 @@ async def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1680,10 +1709,10 @@ async def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1691,14 +1720,14 @@ async def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1814,10 +1843,11 @@ async def begin_restore_blob_ranges( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1842,9 +1872,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def revoke_user_delegation_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1858,7 +1886,7 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1880,7 +1908,6 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_table_operations.py index 15059014d8c9..28de2a34933a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_operations import ( build_create_request, build_delete_request, @@ -41,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -163,7 +160,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2022_05_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -319,7 +315,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2022_05_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -357,7 +353,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -371,7 +366,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -397,7 +392,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str :rtype: ~azure.mgmt.storage.v2022_05_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -420,7 +415,6 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -434,7 +428,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -442,9 +436,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any) -> None: """Deletes the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -462,7 +454,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -485,7 +477,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -523,7 +514,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -542,7 +533,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -558,7 +548,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_table_services_operations.py index f9c294c07f01..137df8f6f181 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2022_05_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -207,7 +203,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2022_05_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +239,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -257,7 +252,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -282,7 +277,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2022_05_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +301,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -320,7 +314,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_usages_operations.py index dda5586e6d9d..c94f6d20e6f0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/aio/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usages_operations import build_list_by_location_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +72,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_mode api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -109,7 +105,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/models/__init__.py index 2f41bf74a603..8d4e9a5603dc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/models/__init__.py @@ -5,222 +5,233 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccessPolicy -from ._models_py3 import AccountImmutabilityPolicyProperties -from ._models_py3 import AccountSasParameters -from ._models_py3 import ActiveDirectoryProperties -from ._models_py3 import AzureEntityResource -from ._models_py3 import AzureFilesIdentityBasedAuthentication -from ._models_py3 import BlobContainer -from ._models_py3 import BlobInventoryPolicy -from ._models_py3 import BlobInventoryPolicyDefinition -from ._models_py3 import BlobInventoryPolicyFilter -from ._models_py3 import BlobInventoryPolicyRule -from ._models_py3 import BlobInventoryPolicySchema -from ._models_py3 import BlobRestoreParameters -from ._models_py3 import BlobRestoreRange -from ._models_py3 import BlobRestoreStatus -from ._models_py3 import BlobServiceItems -from ._models_py3 import BlobServiceProperties -from ._models_py3 import ChangeFeed -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CloudErrorBody -from ._models_py3 import CorsRule -from ._models_py3 import CorsRules -from ._models_py3 import CustomDomain -from ._models_py3 import DateAfterCreation -from ._models_py3 import DateAfterModification -from ._models_py3 import DeleteRetentionPolicy -from ._models_py3 import DeletedAccount -from ._models_py3 import DeletedAccountListResult -from ._models_py3 import DeletedShare -from ._models_py3 import Dimension -from ._models_py3 import Encryption -from ._models_py3 import EncryptionIdentity -from ._models_py3 import EncryptionScope -from ._models_py3 import EncryptionScopeKeyVaultProperties -from ._models_py3 import EncryptionScopeListResult -from ._models_py3 import EncryptionService -from ._models_py3 import EncryptionServices -from ._models_py3 import Endpoints -from ._models_py3 import ErrorResponse -from ._models_py3 import ErrorResponseBody -from ._models_py3 import ExtendedLocation -from ._models_py3 import FileServiceItems -from ._models_py3 import FileServiceProperties -from ._models_py3 import FileShare -from ._models_py3 import FileShareItem -from ._models_py3 import FileShareItems -from ._models_py3 import GeoReplicationStats -from ._models_py3 import IPRule -from ._models_py3 import Identity -from ._models_py3 import ImmutabilityPolicy -from ._models_py3 import ImmutabilityPolicyProperties -from ._models_py3 import ImmutableStorageAccount -from ._models_py3 import ImmutableStorageWithVersioning -from ._models_py3 import KeyCreationTime -from ._models_py3 import KeyPolicy -from ._models_py3 import KeyVaultProperties -from ._models_py3 import LastAccessTimeTrackingPolicy -from ._models_py3 import LeaseContainerRequest -from ._models_py3 import LeaseContainerResponse -from ._models_py3 import LeaseShareRequest -from ._models_py3 import LeaseShareResponse -from ._models_py3 import LegalHold -from ._models_py3 import LegalHoldProperties -from ._models_py3 import ListAccountSasResponse -from ._models_py3 import ListBlobInventoryPolicy -from ._models_py3 import ListContainerItem -from ._models_py3 import ListContainerItems -from ._models_py3 import ListQueue -from ._models_py3 import ListQueueResource -from ._models_py3 import ListQueueServices -from ._models_py3 import ListServiceSasResponse -from ._models_py3 import ListTableResource -from ._models_py3 import ListTableServices -from ._models_py3 import LocalUser -from ._models_py3 import LocalUserKeys -from ._models_py3 import LocalUserRegeneratePasswordResult -from ._models_py3 import LocalUsers -from ._models_py3 import ManagementPolicy -from ._models_py3 import ManagementPolicyAction -from ._models_py3 import ManagementPolicyBaseBlob -from ._models_py3 import ManagementPolicyDefinition -from ._models_py3 import ManagementPolicyFilter -from ._models_py3 import ManagementPolicyRule -from ._models_py3 import ManagementPolicySchema -from ._models_py3 import ManagementPolicySnapShot -from ._models_py3 import ManagementPolicyVersion -from ._models_py3 import MetricSpecification -from ._models_py3 import Multichannel -from ._models_py3 import NetworkRuleSet -from ._models_py3 import ObjectReplicationPolicies -from ._models_py3 import ObjectReplicationPolicy -from ._models_py3 import ObjectReplicationPolicyFilter -from ._models_py3 import ObjectReplicationPolicyRule -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import PermissionScope -from ._models_py3 import PrivateEndpoint -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionListResult -from ._models_py3 import PrivateLinkResource -from ._models_py3 import PrivateLinkResourceListResult -from ._models_py3 import PrivateLinkServiceConnectionState -from ._models_py3 import ProtectedAppendWritesHistory -from ._models_py3 import ProtocolSettings -from ._models_py3 import ProxyResource -from ._models_py3 import QueueServiceProperties -from ._models_py3 import Resource -from ._models_py3 import ResourceAccessRule -from ._models_py3 import RestorePolicyProperties -from ._models_py3 import Restriction -from ._models_py3 import RoutingPreference -from ._models_py3 import SKUCapability -from ._models_py3 import SasPolicy -from ._models_py3 import ServiceSasParameters -from ._models_py3 import ServiceSpecification -from ._models_py3 import SignedIdentifier -from ._models_py3 import Sku -from ._models_py3 import SkuInformation -from ._models_py3 import SmbSetting -from ._models_py3 import SshPublicKey -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountInternetEndpoints -from ._models_py3 import StorageAccountKey -from ._models_py3 import StorageAccountListKeysResult -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountMicrosoftEndpoints -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountSkuConversionStatus -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import StorageQueue -from ._models_py3 import StorageSkuListResult -from ._models_py3 import SystemData -from ._models_py3 import Table -from ._models_py3 import TableAccessPolicy -from ._models_py3 import TableServiceProperties -from ._models_py3 import TableSignedIdentifier -from ._models_py3 import TagFilter -from ._models_py3 import TagProperty -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateHistoryProperty -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName -from ._models_py3 import UserAssignedIdentity -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._storage_management_client_enums import AccessTier -from ._storage_management_client_enums import AccountImmutabilityPolicyState -from ._storage_management_client_enums import AccountStatus -from ._storage_management_client_enums import AccountType -from ._storage_management_client_enums import AllowedCopyScope -from ._storage_management_client_enums import AllowedMethods -from ._storage_management_client_enums import BlobInventoryPolicyName -from ._storage_management_client_enums import BlobRestoreProgressStatus -from ._storage_management_client_enums import Bypass -from ._storage_management_client_enums import CreatedByType -from ._storage_management_client_enums import DefaultAction -from ._storage_management_client_enums import DefaultSharePermission -from ._storage_management_client_enums import DirectoryServiceOptions -from ._storage_management_client_enums import DnsEndpointType -from ._storage_management_client_enums import EnabledProtocols -from ._storage_management_client_enums import EncryptionScopeSource -from ._storage_management_client_enums import EncryptionScopeState -from ._storage_management_client_enums import ExpirationAction -from ._storage_management_client_enums import ExtendedLocationTypes -from ._storage_management_client_enums import Format -from ._storage_management_client_enums import GeoReplicationStatus -from ._storage_management_client_enums import HttpProtocol -from ._storage_management_client_enums import IdentityType -from ._storage_management_client_enums import ImmutabilityPolicyState -from ._storage_management_client_enums import ImmutabilityPolicyUpdateType -from ._storage_management_client_enums import InventoryRuleType -from ._storage_management_client_enums import KeyPermission -from ._storage_management_client_enums import KeySource -from ._storage_management_client_enums import KeyType -from ._storage_management_client_enums import Kind -from ._storage_management_client_enums import LargeFileSharesState -from ._storage_management_client_enums import LeaseContainerRequestEnum -from ._storage_management_client_enums import LeaseDuration -from ._storage_management_client_enums import LeaseShareAction -from ._storage_management_client_enums import LeaseState -from ._storage_management_client_enums import LeaseStatus -from ._storage_management_client_enums import ListContainersInclude -from ._storage_management_client_enums import ManagementPolicyName -from ._storage_management_client_enums import MigrationState -from ._storage_management_client_enums import MinimumTlsVersion -from ._storage_management_client_enums import Name -from ._storage_management_client_enums import ObjectType -from ._storage_management_client_enums import Permissions -from ._storage_management_client_enums import PrivateEndpointConnectionProvisioningState -from ._storage_management_client_enums import PrivateEndpointServiceConnectionStatus -from ._storage_management_client_enums import ProvisioningState -from ._storage_management_client_enums import PublicAccess -from ._storage_management_client_enums import PublicNetworkAccess -from ._storage_management_client_enums import Reason -from ._storage_management_client_enums import ReasonCode -from ._storage_management_client_enums import RootSquashType -from ._storage_management_client_enums import RoutingChoice -from ._storage_management_client_enums import RuleType -from ._storage_management_client_enums import Schedule -from ._storage_management_client_enums import Services -from ._storage_management_client_enums import ShareAccessTier -from ._storage_management_client_enums import SignedResource -from ._storage_management_client_enums import SignedResourceTypes -from ._storage_management_client_enums import SkuConversionStatus -from ._storage_management_client_enums import SkuName -from ._storage_management_client_enums import SkuTier -from ._storage_management_client_enums import State -from ._storage_management_client_enums import StorageAccountExpand -from ._storage_management_client_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccessPolicy, + AccountImmutabilityPolicyProperties, + AccountSasParameters, + ActiveDirectoryProperties, + AzureEntityResource, + AzureFilesIdentityBasedAuthentication, + BlobContainer, + BlobInventoryPolicy, + BlobInventoryPolicyDefinition, + BlobInventoryPolicyFilter, + BlobInventoryPolicyRule, + BlobInventoryPolicySchema, + BlobRestoreParameters, + BlobRestoreRange, + BlobRestoreStatus, + BlobServiceItems, + BlobServiceProperties, + ChangeFeed, + CheckNameAvailabilityResult, + CloudErrorBody, + CorsRule, + CorsRules, + CustomDomain, + DateAfterCreation, + DateAfterModification, + DeleteRetentionPolicy, + DeletedAccount, + DeletedAccountListResult, + DeletedShare, + Dimension, + Encryption, + EncryptionIdentity, + EncryptionScope, + EncryptionScopeKeyVaultProperties, + EncryptionScopeListResult, + EncryptionService, + EncryptionServices, + Endpoints, + ErrorResponse, + ErrorResponseBody, + ExtendedLocation, + FileServiceItems, + FileServiceProperties, + FileShare, + FileShareItem, + FileShareItems, + GeoReplicationStats, + IPRule, + Identity, + ImmutabilityPolicy, + ImmutabilityPolicyProperties, + ImmutableStorageAccount, + ImmutableStorageWithVersioning, + KeyCreationTime, + KeyPolicy, + KeyVaultProperties, + LastAccessTimeTrackingPolicy, + LeaseContainerRequest, + LeaseContainerResponse, + LeaseShareRequest, + LeaseShareResponse, + LegalHold, + LegalHoldProperties, + ListAccountSasResponse, + ListBlobInventoryPolicy, + ListContainerItem, + ListContainerItems, + ListQueue, + ListQueueResource, + ListQueueServices, + ListServiceSasResponse, + ListTableResource, + ListTableServices, + LocalUser, + LocalUserKeys, + LocalUserRegeneratePasswordResult, + LocalUsers, + ManagementPolicy, + ManagementPolicyAction, + ManagementPolicyBaseBlob, + ManagementPolicyDefinition, + ManagementPolicyFilter, + ManagementPolicyRule, + ManagementPolicySchema, + ManagementPolicySnapShot, + ManagementPolicyVersion, + MetricSpecification, + Multichannel, + NetworkRuleSet, + ObjectReplicationPolicies, + ObjectReplicationPolicy, + ObjectReplicationPolicyFilter, + ObjectReplicationPolicyRule, + Operation, + OperationDisplay, + OperationListResult, + PermissionScope, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionListResult, + PrivateLinkResource, + PrivateLinkResourceListResult, + PrivateLinkServiceConnectionState, + ProtectedAppendWritesHistory, + ProtocolSettings, + ProxyResource, + QueueServiceProperties, + Resource, + ResourceAccessRule, + RestorePolicyProperties, + Restriction, + RoutingPreference, + SKUCapability, + SasPolicy, + ServiceSasParameters, + ServiceSpecification, + SignedIdentifier, + Sku, + SkuInformation, + SmbSetting, + SshPublicKey, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountInternetEndpoints, + StorageAccountKey, + StorageAccountListKeysResult, + StorageAccountListResult, + StorageAccountMicrosoftEndpoints, + StorageAccountRegenerateKeyParameters, + StorageAccountSkuConversionStatus, + StorageAccountUpdateParameters, + StorageQueue, + StorageSkuListResult, + SystemData, + Table, + TableAccessPolicy, + TableServiceProperties, + TableSignedIdentifier, + TagFilter, + TagProperty, + TrackedResource, + UpdateHistoryProperty, + Usage, + UsageListResult, + UsageName, + UserAssignedIdentity, + VirtualNetworkRule, +) + +from ._storage_management_client_enums import ( # type: ignore + AccessTier, + AccountImmutabilityPolicyState, + AccountStatus, + AccountType, + AllowedCopyScope, + AllowedMethods, + BlobInventoryPolicyName, + BlobRestoreProgressStatus, + Bypass, + CreatedByType, + DefaultAction, + DefaultSharePermission, + DirectoryServiceOptions, + DnsEndpointType, + EnabledProtocols, + EncryptionScopeSource, + EncryptionScopeState, + ExpirationAction, + ExtendedLocationTypes, + Format, + GeoReplicationStatus, + HttpProtocol, + IdentityType, + ImmutabilityPolicyState, + ImmutabilityPolicyUpdateType, + InventoryRuleType, + KeyPermission, + KeySource, + KeyType, + Kind, + LargeFileSharesState, + LeaseContainerRequestEnum, + LeaseDuration, + LeaseShareAction, + LeaseState, + LeaseStatus, + ListContainersInclude, + ManagementPolicyName, + MigrationState, + MinimumTlsVersion, + Name, + ObjectType, + Permissions, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProvisioningState, + PublicAccess, + PublicNetworkAccess, + Reason, + ReasonCode, + RootSquashType, + RoutingChoice, + RuleType, + Schedule, + Services, + ShareAccessTier, + SignedResource, + SignedResourceTypes, + SkuConversionStatus, + SkuName, + SkuTier, + State, + StorageAccountExpand, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -437,5 +448,5 @@ "StorageAccountExpand", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/models/_models_py3.py index 6676e407cce5..02da97f394d6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,7 +13,6 @@ from ... import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -440,7 +439,7 @@ def __init__( self.default_share_permission = default_share_permission -class BlobContainer(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class BlobContainer(AzureEntityResource): """Properties of the blob container, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -1107,7 +1106,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class BlobServiceProperties(Resource): # pylint: disable=too-many-instance-attributes +class BlobServiceProperties(Resource): """The properties of a storage account’s Blob service. Variables are only populated by the server, and will be ignored when sending a request. @@ -2420,7 +2419,7 @@ def __init__( self.protocol_settings = protocol_settings -class FileShare(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShare(AzureEntityResource): """Properties of the file share, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -2578,7 +2577,7 @@ def __init__( self.snapshot_time = None -class FileShareItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShareItem(AzureEntityResource): """The file share properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -3342,7 +3341,7 @@ class LeaseContainerRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2022_05_01.models.LeaseContainerRequestEnum :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -3381,7 +3380,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2022_05_01.models.LeaseContainerRequestEnum :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -3439,7 +3438,7 @@ class LeaseShareRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2022_05_01.models.LeaseShareAction :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -3478,7 +3477,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2022_05_01.models.LeaseShareAction :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -3676,7 +3675,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class ListContainerItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class ListContainerItem(AzureEntityResource): """The blob container properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -4044,7 +4043,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class LocalUser(Resource): # pylint: disable=too-many-instance-attributes +class LocalUser(Resource): """The local user associated with the storage accounts. Variables are only populated by the server, and will be ignored when sending a request. @@ -5642,7 +5641,7 @@ def __init__( self.expiration_action = expiration_action -class ServiceSasParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ServiceSasParameters(_serialization.Model): """The parameters to list service SAS credentials of a specific resource. All required parameters must be populated in order to send to server. @@ -6076,7 +6075,7 @@ class SshPublicKey(_serialization.Model): :ivar description: Optional. It is used to store the function/usage of the key. :vartype description: str - :ivar key: Ssh public key base64 encoded. The format should be: ':code:`` + :ivar key: Ssh public key base64 encoded. The format should be: '\\ :code:`` :code:``', e.g. ssh-rsa AAAABBBB. :vartype key: str """ @@ -6090,7 +6089,7 @@ def __init__(self, *, description: Optional[str] = None, key: Optional[str] = No """ :keyword description: Optional. It is used to store the function/usage of the key. :paramtype description: str - :keyword key: Ssh public key base64 encoded. The format should be: ':code:`` + :keyword key: Ssh public key base64 encoded. The format should be: '\\ :code:`` :code:``', e.g. ssh-rsa AAAABBBB. :paramtype key: str """ @@ -6148,7 +6147,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class StorageAccount(TrackedResource): # pylint: disable=too-many-instance-attributes +class StorageAccount(TrackedResource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. @@ -6568,7 +6567,7 @@ def __init__(self, *, name: str, **kwargs: Any) -> None: self.name = name -class StorageAccountCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountCreateParameters(_serialization.Model): """The parameters used when creating a storage account. All required parameters must be populated in order to send to server. @@ -7137,7 +7136,7 @@ def __init__(self, *, target_sku_name: Optional[Union[str, "_models.SkuName"]] = self.end_time = None -class StorageAccountUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountUpdateParameters(_serialization.Model): """The parameters that can be provided when updating the storage account properties. :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/models/_storage_management_client_enums.py index d93e08dd22d6..3c9ba4b4feed 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/models/_storage_management_client_enums.py @@ -292,6 +292,7 @@ class LeaseContainerRequestEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" @@ -311,6 +312,7 @@ class LeaseShareAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/__init__.py index bbce85749d18..a0549517e087 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/__init__.py @@ -5,30 +5,36 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._local_users_operations import LocalUsersOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._local_users_operations import LocalUsersOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -53,5 +59,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_blob_containers_operations.py index 8bdad8379973..ddf0cd794b6a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -649,7 +649,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -671,7 +671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -687,7 +686,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -822,7 +820,7 @@ def create( :rtype: ~azure.mgmt.storage.v2022_05_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -857,7 +855,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -871,11 +868,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -985,7 +978,7 @@ def update( :rtype: ~azure.mgmt.storage.v2022_05_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1020,7 +1013,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1034,7 +1026,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1063,7 +1055,7 @@ def get( :rtype: ~azure.mgmt.storage.v2022_05_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1086,7 +1078,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1100,7 +1091,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1129,7 +1120,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1152,7 +1143,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1275,7 +1265,7 @@ def set_legal_hold( :rtype: ~azure.mgmt.storage.v2022_05_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1310,7 +1300,6 @@ def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1324,7 +1313,7 @@ def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1434,7 +1423,7 @@ def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2022_05_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1469,7 +1458,6 @@ def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1483,7 +1471,7 @@ def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1610,7 +1598,7 @@ def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1651,7 +1639,6 @@ def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1668,7 +1655,7 @@ def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1707,7 +1694,7 @@ def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1733,7 +1720,6 @@ def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1750,7 +1736,7 @@ def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1786,7 +1772,7 @@ def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1812,7 +1798,6 @@ def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1829,7 +1814,7 @@ def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1863,7 +1848,7 @@ def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1887,7 +1872,6 @@ def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1904,7 +1888,7 @@ def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2034,7 +2018,7 @@ def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2073,7 +2057,6 @@ def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2090,7 +2073,7 @@ def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2200,7 +2183,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2022_05_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2238,7 +2221,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2252,17 +2234,17 @@ def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _object_level_worm_initial( # pylint: disable=inconsistent-return-statements + def _object_level_worm_initial( self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2274,7 +2256,7 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_object_level_worm_request( resource_group_name=resource_group_name, @@ -2285,10 +2267,10 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2296,11 +2278,19 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_object_level_worm( @@ -2336,7 +2326,7 @@ def begin_object_level_worm( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._object_level_worm_initial( # type: ignore + raw_result = self._object_level_worm_initial( resource_group_name=resource_group_name, account_name=account_name, container_name=container_name, @@ -2346,6 +2336,7 @@ def begin_object_level_worm( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_blob_inventory_policies_operations.py index fb62d33ea7aa..0c488c36e1d0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -235,7 +232,7 @@ def get( :rtype: ~azure.mgmt.storage.v2022_05_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +255,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -272,7 +268,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -376,7 +372,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2022_05_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,7 +407,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -425,7 +420,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -457,7 +452,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -480,7 +475,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -521,7 +515,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -540,7 +534,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -556,7 +549,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_blob_services_operations.py index 768c8f2a49b1..527943aed5f2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -191,7 +188,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -210,7 +207,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -226,7 +222,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -343,7 +338,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2022_05_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -379,7 +374,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -393,7 +387,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -418,7 +412,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2022_05_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -442,7 +436,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -456,7 +449,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_deleted_accounts_operations.py index 793bfce70601..aefad7271543 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -130,7 +127,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.DeletedAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -147,7 +144,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -163,7 +159,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -205,7 +200,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model :rtype: ~azure.mgmt.storage.v2022_05_01.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +222,6 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -242,7 +236,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_encryption_scopes_operations.py index a693046c4031..5bbc349d8674 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -315,7 +312,7 @@ def put( :rtype: ~azure.mgmt.storage.v2022_05_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -350,7 +347,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -365,11 +361,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -479,7 +471,7 @@ def patch( :rtype: ~azure.mgmt.storage.v2022_05_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -514,7 +506,6 @@ def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -529,7 +520,7 @@ def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -558,7 +549,7 @@ def get( :rtype: ~azure.mgmt.storage.v2022_05_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -581,7 +572,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -596,7 +586,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -624,7 +614,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -643,7 +633,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -659,7 +648,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_file_services_operations.py index 4a234f3fb28e..732ba9eb8a34 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -179,7 +176,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2022_05_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -310,7 +306,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2022_05_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +342,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -360,7 +355,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -385,7 +380,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2022_05_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -409,7 +404,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -423,7 +417,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_file_shares_operations.py index 81509f7acb12..fff530043218 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_file_shares_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -401,7 +399,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +421,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -439,7 +436,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -586,7 +582,7 @@ def create( :rtype: ~azure.mgmt.storage.v2022_05_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -622,7 +618,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -636,11 +631,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -750,7 +741,7 @@ def update( :rtype: ~azure.mgmt.storage.v2022_05_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -785,7 +776,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -799,7 +789,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -840,7 +830,7 @@ def get( :rtype: ~azure.mgmt.storage.v2022_05_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -865,7 +855,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -879,7 +868,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -924,7 +913,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -949,7 +938,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -967,7 +955,7 @@ def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -1002,7 +990,7 @@ def restore( # pylint: disable=inconsistent-return-statements """ @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -1065,7 +1053,7 @@ def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1100,7 +1088,6 @@ def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1232,7 +1219,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2022_05_01.models.LeaseShareResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1271,7 +1258,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1288,7 +1274,7 @@ def lease( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("LeaseShareResponse", pipeline_response) + deserialized = self._deserialize("LeaseShareResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_local_users_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_local_users_operations.py index 6a1eb2d305c5..7580815da5b7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_local_users_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_local_users_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -287,7 +284,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.LocalUsers] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +303,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -322,7 +318,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -370,7 +365,7 @@ def get(self, resource_group_name: str, account_name: str, username: str, **kwar :rtype: ~azure.mgmt.storage.v2022_05_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -393,7 +388,6 @@ def get(self, resource_group_name: str, account_name: str, username: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -408,7 +402,7 @@ def get(self, resource_group_name: str, account_name: str, username: str, **kwar error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -509,7 +503,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2022_05_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -544,7 +538,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -559,7 +552,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -586,7 +579,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -609,7 +602,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -647,7 +639,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2022_05_01.models.LocalUserKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -670,7 +662,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -685,7 +676,7 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserKeys", pipeline_response) + deserialized = self._deserialize("LocalUserKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -712,7 +703,7 @@ def regenerate_password( :rtype: ~azure.mgmt.storage.v2022_05_01.models.LocalUserRegeneratePasswordResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -735,7 +726,6 @@ def regenerate_password( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -750,7 +740,7 @@ def regenerate_password( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response) + deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_management_policies_operations.py index 0db22cc87ce9..8860dc87b2a0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -196,7 +193,7 @@ def get( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,7 +216,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -233,7 +229,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +333,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +368,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -386,7 +381,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -418,7 +413,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -441,7 +436,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_object_replication_policies_operations.py index cf56b4ded764..b33304c5dfb6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -229,7 +226,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -248,7 +245,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -264,7 +260,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -316,7 +311,7 @@ def get( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -339,7 +334,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +348,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +458,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +493,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -514,7 +507,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -543,7 +536,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +559,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_operations.py index 69bd85c2d459..8d94491047d0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -126,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_private_endpoint_connections_operations.py index aa88a9ff3b4e..31d0abb8a037 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -241,7 +238,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,7 +257,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -276,7 +272,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -325,7 +320,7 @@ def get( :rtype: ~azure.mgmt.storage.v2022_05_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +343,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -363,7 +357,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +458,7 @@ def put( :rtype: ~azure.mgmt.storage.v2022_05_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +493,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -514,7 +507,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -541,7 +534,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -564,7 +557,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_private_link_resources_operations.py index 4a0f3a0a27cd..998e8b70a803 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -109,7 +106,7 @@ def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2022_05_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -131,7 +128,6 @@ def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -145,7 +141,7 @@ def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_queue_operations.py index 387d49ea5472..19f6fc99495d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -375,7 +372,7 @@ def create( :rtype: ~azure.mgmt.storage.v2022_05_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -410,7 +407,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -424,7 +420,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -531,7 +527,7 @@ def update( :rtype: ~azure.mgmt.storage.v2022_05_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +562,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -580,7 +575,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -607,7 +602,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw :rtype: ~azure.mgmt.storage.v2022_05_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -630,7 +625,6 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -644,7 +638,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -673,7 +667,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -696,7 +690,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -747,7 +740,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -768,7 +761,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -784,7 +776,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_queue_services_operations.py index 50bff0091287..2aca25bc1bd3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -179,7 +176,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2022_05_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -310,7 +306,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2022_05_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +342,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -360,7 +355,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -385,7 +380,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2022_05_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -409,7 +404,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -423,7 +417,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_skus_operations.py index 41e93c27fed0..d3ad82985f49 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_storage_accounts_operations.py index 88d17fc28878..761bf065adce 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -649,7 +649,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2022_05_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -681,7 +681,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -695,7 +694,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -708,8 +707,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -722,7 +721,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -743,10 +742,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -754,12 +753,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -882,10 +883,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -924,7 +926,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -946,7 +948,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -991,7 +992,7 @@ def get_properties( :rtype: ~azure.mgmt.storage.v2022_05_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1014,7 +1015,6 @@ def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1028,7 +1028,7 @@ def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1139,7 +1139,7 @@ def update( :rtype: ~azure.mgmt.storage.v2022_05_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1173,7 +1173,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1187,7 +1186,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1209,7 +1208,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1226,7 +1225,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1242,7 +1240,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1289,7 +1286,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1307,7 +1304,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1323,7 +1319,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1373,7 +1368,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2022_05_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1396,7 +1391,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1410,7 +1404,7 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1504,7 +1498,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2022_05_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1538,7 +1532,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1552,7 +1545,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1643,7 +1636,7 @@ def list_account_sas( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1677,7 +1670,6 @@ def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1691,7 +1683,7 @@ def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1780,7 +1772,7 @@ def list_service_sas( :rtype: ~azure.mgmt.storage.v2022_05_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1814,7 +1806,6 @@ def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1828,17 +1819,15 @@ def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _failover_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _failover_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1850,7 +1839,7 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1860,10 +1849,10 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1871,11 +1860,19 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: Any) -> LROPoller[None]: @@ -1903,7 +1900,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._failover_initial( # type: ignore + raw_result = self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1912,6 +1909,7 @@ def begin_failover(self, resource_group_name: str, account_name: str, **kwargs: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1935,10 +1933,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, request_type: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1950,7 +1948,7 @@ def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-r _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -1961,10 +1959,10 @@ def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1972,12 +1970,20 @@ def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_hierarchical_namespace_migration( @@ -2010,7 +2016,7 @@ def begin_hierarchical_namespace_migration( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._hierarchical_namespace_migration_initial( # type: ignore + raw_result = self._hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, request_type=request_type, @@ -2020,6 +2026,7 @@ def begin_hierarchical_namespace_migration( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2043,10 +2050,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _abort_hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2058,7 +2065,7 @@ def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_abort_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -2068,10 +2075,10 @@ def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2079,12 +2086,20 @@ def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-long @@ -2112,7 +2127,7 @@ def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-lo lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._abort_hierarchical_namespace_migration_initial( # type: ignore + raw_result = self._abort_hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -2121,6 +2136,7 @@ def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-lo params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2150,8 +2166,8 @@ def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2164,7 +2180,7 @@ def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2185,10 +2201,10 @@ def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2196,14 +2212,14 @@ def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2316,10 +2332,11 @@ def begin_restore_blob_ranges( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2360,7 +2377,7 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2382,7 +2399,6 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_table_operations.py index 1d8aece03a71..5f429cb5e110 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -340,7 +337,7 @@ def create( :rtype: ~azure.mgmt.storage.v2022_05_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -378,7 +375,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -392,7 +388,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -496,7 +492,7 @@ def update( :rtype: ~azure.mgmt.storage.v2022_05_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -534,7 +530,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -548,7 +543,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -574,7 +569,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw :rtype: ~azure.mgmt.storage.v2022_05_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -597,7 +592,6 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -611,7 +605,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -639,7 +633,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -662,7 +656,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -700,7 +693,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -719,7 +712,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -735,7 +727,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_table_services_operations.py index 21f1afb60297..60015c298721 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -179,7 +176,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2022_05_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -310,7 +306,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2022_05_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +342,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -360,7 +355,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -385,7 +380,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2022_05_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -409,7 +404,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -423,7 +417,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_usages_operations.py index 386b96c60938..2d7138e92413 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_05_01/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -105,7 +102,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.Us api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -139,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/__init__.py index a860a5c185c9..60980065e1ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/_configuration.py index 663c09473419..47262e93fe43 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/_metadata.json index 866808f02b2b..cc0ba7b244aa 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/_storage_management_client.py index 15e6eaf7e927..f244d88c7c58 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -41,11 +42,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -217,7 +217,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/_version.py index 5a163c0afedc..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" \ No newline at end of file +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/__init__.py index a5c3d2414cfd..ee2b940bd4fc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/_configuration.py index 4c03fa880515..8161bb587f49 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/_storage_management_client.py index c4dc5717ca8c..64344c3c6ec0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -41,11 +42,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -222,7 +222,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/__init__.py index bbce85749d18..a0549517e087 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/__init__.py @@ -5,30 +5,36 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._local_users_operations import LocalUsersOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._local_users_operations import LocalUsersOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -53,5 +59,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_blob_containers_operations.py index e69b535eeafd..676f0c50ed08 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_containers_operations import ( build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, @@ -52,7 +65,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -117,7 +130,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -139,7 +152,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -155,7 +167,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -290,7 +301,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2022_09_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -325,7 +336,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -339,11 +349,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -453,7 +459,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2022_09_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -488,7 +494,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -502,7 +507,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -531,7 +536,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2022_09_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -554,7 +559,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -568,7 +572,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -576,9 +580,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -597,7 +599,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -620,7 +622,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -743,7 +744,7 @@ async def set_legal_hold( :rtype: ~azure.mgmt.storage.v2022_09_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -778,7 +779,6 @@ async def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -792,7 +792,7 @@ async def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -902,7 +902,7 @@ async def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2022_09_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -937,7 +937,6 @@ async def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -951,7 +950,7 @@ async def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1078,7 +1077,7 @@ async def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1119,7 +1118,6 @@ async def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1136,7 +1134,7 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1175,7 +1173,7 @@ async def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1201,7 +1199,6 @@ async def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1218,7 +1215,7 @@ async def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1254,7 +1251,7 @@ async def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1280,7 +1277,6 @@ async def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1297,7 +1293,7 @@ async def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1331,7 +1327,7 @@ async def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1355,7 +1351,6 @@ async def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1372,7 +1367,7 @@ async def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1502,7 +1497,7 @@ async def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1541,7 +1536,6 @@ async def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1558,7 +1552,7 @@ async def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1668,7 +1662,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2022_09_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1706,7 +1700,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1720,17 +1713,17 @@ async def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _object_level_worm_initial( # pylint: disable=inconsistent-return-statements + async def _object_level_worm_initial( self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1742,7 +1735,7 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_object_level_worm_request( resource_group_name=resource_group_name, @@ -1753,10 +1746,10 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1764,11 +1757,19 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_object_level_worm( @@ -1804,7 +1805,7 @@ async def begin_object_level_worm( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._object_level_worm_initial( # type: ignore + raw_result = await self._object_level_worm_initial( resource_group_name=resource_group_name, account_name=account_name, container_name=container_name, @@ -1814,6 +1815,7 @@ async def begin_object_level_worm( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_blob_inventory_policies_operations.py index 17831ebf898e..25e38deff2b6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_inventory_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2022_09_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,7 +110,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -127,7 +123,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -231,7 +227,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2022_09_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -266,7 +262,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -280,7 +275,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -288,7 +283,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -312,7 +307,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -335,7 +330,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -376,7 +370,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -395,7 +389,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -411,7 +404,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_blob_services_operations.py index 5f65efc5f746..b0d4f301fda2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_services_operations import ( build_get_service_properties_request, build_list_request, @@ -39,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +86,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -241,7 +236,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2022_09_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -277,7 +272,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -291,7 +285,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -316,7 +310,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2022_09_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -340,7 +334,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +347,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_deleted_accounts_operations.py index 2b0e47640500..6f9bd72e19a4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,21 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_accounts_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DeletedAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +88,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -107,7 +103,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -149,7 +144,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> :rtype: ~azure.mgmt.storage.v2022_09_01.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +166,6 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -186,7 +180,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_encryption_scopes_operations.py index caac59cc09f4..bae623e9b794 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._encryption_scopes_operations import ( build_get_request, build_list_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -173,7 +170,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2022_09_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +205,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -223,11 +219,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +329,7 @@ async def patch( :rtype: ~azure.mgmt.storage.v2022_09_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +364,6 @@ async def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -387,7 +378,7 @@ async def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -416,7 +407,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2022_09_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -439,7 +430,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -454,7 +444,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -500,7 +490,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -522,7 +512,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -538,7 +527,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_file_services_operations.py index 6ce13d5a6331..9ece8a5f1276 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2022_09_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -207,7 +203,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2022_09_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +239,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -257,7 +252,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -282,7 +277,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2022_09_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +301,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -320,7 +314,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_file_shares_operations.py index 09dc046a559a..6fc4f05a93b2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_file_shares_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_shares_operations import ( build_create_request, build_delete_request, @@ -43,7 +40,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -108,7 +105,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -130,7 +127,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -146,7 +142,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -293,7 +288,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2022_09_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -329,7 +324,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -343,11 +337,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -457,7 +447,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2022_09_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -492,7 +482,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -506,7 +495,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -547,7 +536,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2022_09_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -572,7 +561,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -586,7 +574,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -594,7 +582,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -631,7 +619,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -656,7 +644,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -674,7 +661,7 @@ async def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -709,7 +696,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -744,7 +731,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -772,7 +759,7 @@ async def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -807,7 +794,6 @@ async def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -939,7 +925,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2022_09_01.models.LeaseShareResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -978,7 +964,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -995,7 +980,7 @@ async def lease( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("LeaseShareResponse", pipeline_response) + deserialized = self._deserialize("LeaseShareResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_local_users_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_local_users_operations.py index 524e4a9928eb..64f69257ae4f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_local_users_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_local_users_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._local_users_operations import ( build_create_or_update_request, build_delete_request, @@ -42,7 +39,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +86,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.LocalUsers] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -172,7 +167,7 @@ async def get(self, resource_group_name: str, account_name: str, username: str, :rtype: ~azure.mgmt.storage.v2022_09_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -195,7 +190,6 @@ async def get(self, resource_group_name: str, account_name: str, username: str, headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -210,7 +204,7 @@ async def get(self, resource_group_name: str, account_name: str, username: str, error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -311,7 +305,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2022_09_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +340,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -361,7 +354,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -369,9 +362,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, username: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, username: str, **kwargs: Any) -> None: """Deletes the local user associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -388,7 +379,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,7 +402,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -449,7 +439,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2022_09_01.models.LocalUserKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -472,7 +462,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -487,7 +476,7 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserKeys", pipeline_response) + deserialized = self._deserialize("LocalUserKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -514,7 +503,7 @@ async def regenerate_password( :rtype: ~azure.mgmt.storage.v2022_09_01.models.LocalUserRegeneratePasswordResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -537,7 +526,6 @@ async def regenerate_password( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -552,7 +540,7 @@ async def regenerate_password( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response) + deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_management_policies_operations.py index 0afaffcc28a4..d56c9ee27e13 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._management_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +119,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -227,7 +223,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -262,7 +258,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -276,7 +271,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -284,7 +279,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -308,7 +303,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +326,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_object_replication_policies_operations.py index 5810275783fe..346db5108247 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._object_replication_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -177,7 +172,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -200,7 +195,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +209,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -325,7 +319,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -360,7 +354,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -375,7 +368,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -383,7 +376,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, object_replication_policy_id: str, **kwargs: Any ) -> None: """Deletes the object replication policy associated with the specified storage account. @@ -404,7 +397,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +420,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_operations.py index f56ed4728f31..6b06e8050bcb 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_private_endpoint_connections_operations.py index 224adfe0469c..dda97589923a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connections_operations import ( build_delete_request, build_get_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -174,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2022_09_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -197,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -212,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -313,7 +307,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2022_09_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +342,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -363,7 +356,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -371,7 +364,7 @@ async def put( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: """Deletes the specified private endpoint connection associated with the storage account. @@ -390,7 +383,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -413,7 +406,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_private_link_resources_operations.py index df68dbf3f592..7ba7d577cdf3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_by_storage_account_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ async def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2022_09_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,7 +92,6 @@ async def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +105,7 @@ async def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_queue_operations.py index f390424dd011..15095db4a799 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_operations import ( build_create_request, build_delete_request, @@ -41,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -166,7 +163,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2022_09_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -322,7 +318,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2022_09_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -357,7 +353,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -371,7 +366,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -400,7 +395,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2022_09_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +418,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -437,7 +431,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -445,9 +439,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any) -> None: """Deletes the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -466,7 +458,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -489,7 +481,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -541,7 +532,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -562,7 +553,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -578,7 +568,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_queue_services_operations.py index 4712ca208346..621b54d50bbf 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2022_09_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -207,7 +203,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2022_09_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +239,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -257,7 +252,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -282,7 +277,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2022_09_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +301,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -320,7 +314,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_skus_operations.py index c3f028152658..8b3457a131ce 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -90,7 +87,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -106,7 +102,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_storage_accounts_operations.py index 8a09b77ceae7..637537b01d13 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_abort_hierarchical_namespace_migration_request, build_check_name_availability_request, @@ -54,7 +67,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -137,7 +150,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2022_09_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -169,7 +182,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -183,7 +195,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -196,8 +208,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -210,7 +222,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -231,10 +243,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -242,12 +254,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -373,10 +387,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -399,9 +414,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -415,7 +428,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -437,7 +450,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -482,7 +494,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2022_09_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -505,7 +517,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -519,7 +530,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -630,7 +641,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2022_09_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -664,7 +675,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -678,7 +688,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -701,7 +711,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -718,7 +728,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -734,7 +743,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -784,7 +792,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -802,7 +810,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -818,7 +825,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -868,7 +874,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2022_09_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -891,7 +897,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -905,7 +910,7 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -999,7 +1004,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2022_09_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1033,7 +1038,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1047,7 +1051,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1138,7 +1142,7 @@ async def list_account_sas( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1172,7 +1176,6 @@ async def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1186,7 +1189,7 @@ async def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1275,7 +1278,7 @@ async def list_service_sas( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1309,7 +1312,6 @@ async def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1323,17 +1325,17 @@ async def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _failover_initial( # pylint: disable=inconsistent-return-statements + async def _failover_initial( self, resource_group_name: str, account_name: str, failover_type: Literal["Planned"] = "Planned", **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1345,7 +1347,7 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1356,10 +1358,10 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1367,11 +1369,19 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_failover( @@ -1412,7 +1422,7 @@ async def begin_failover( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._failover_initial( # type: ignore + raw_result = await self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, failover_type=failover_type, @@ -1422,6 +1432,7 @@ async def begin_failover( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1445,10 +1456,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, request_type: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1460,7 +1471,7 @@ async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -1471,10 +1482,10 @@ async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1482,12 +1493,20 @@ async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_hierarchical_namespace_migration( @@ -1520,7 +1539,7 @@ async def begin_hierarchical_namespace_migration( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._hierarchical_namespace_migration_initial( # type: ignore + raw_result = await self._hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, request_type=request_type, @@ -1530,6 +1549,7 @@ async def begin_hierarchical_namespace_migration( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1553,10 +1573,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1568,7 +1588,7 @@ async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=in _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_abort_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -1578,10 +1598,10 @@ async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=in headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1589,12 +1609,20 @@ async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-long @@ -1622,7 +1650,7 @@ async def begin_abort_hierarchical_namespace_migration( # pylint: disable=name- lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._abort_hierarchical_namespace_migration_initial( # type: ignore + raw_result = await self._abort_hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1631,6 +1659,7 @@ async def begin_abort_hierarchical_namespace_migration( # pylint: disable=name- params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1660,8 +1689,8 @@ async def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1674,7 +1703,7 @@ async def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1695,10 +1724,10 @@ async def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1706,14 +1735,14 @@ async def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1829,10 +1858,11 @@ async def begin_restore_blob_ranges( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1857,9 +1887,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def revoke_user_delegation_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -1873,7 +1901,7 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1895,7 +1923,6 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_table_operations.py index 83a71daa17d8..c0cfcc41d371 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_operations import ( build_create_request, build_delete_request, @@ -41,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -163,7 +160,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2022_09_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -319,7 +315,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2022_09_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -357,7 +353,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -371,7 +366,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -397,7 +392,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str :rtype: ~azure.mgmt.storage.v2022_09_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -420,7 +415,6 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -434,7 +428,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -442,9 +436,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any) -> None: """Deletes the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -462,7 +454,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -485,7 +477,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -523,7 +514,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -542,7 +533,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -558,7 +548,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_table_services_operations.py index 0a5825a325b9..f81cbf874d41 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2022_09_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -207,7 +203,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2022_09_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +239,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -257,7 +252,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -282,7 +277,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2022_09_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +301,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -320,7 +314,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_usages_operations.py index 6caeb1a5af5b..8a19c7c5b1b6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/aio/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usages_operations import build_list_by_location_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +72,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_mode api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -109,7 +105,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/models/__init__.py index 599c5f794607..9a92a1244148 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/models/__init__.py @@ -5,223 +5,234 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccessPolicy -from ._models_py3 import AccountImmutabilityPolicyProperties -from ._models_py3 import AccountSasParameters -from ._models_py3 import ActiveDirectoryProperties -from ._models_py3 import AzureEntityResource -from ._models_py3 import AzureFilesIdentityBasedAuthentication -from ._models_py3 import BlobContainer -from ._models_py3 import BlobInventoryPolicy -from ._models_py3 import BlobInventoryPolicyDefinition -from ._models_py3 import BlobInventoryPolicyFilter -from ._models_py3 import BlobInventoryPolicyRule -from ._models_py3 import BlobInventoryPolicySchema -from ._models_py3 import BlobRestoreParameters -from ._models_py3 import BlobRestoreRange -from ._models_py3 import BlobRestoreStatus -from ._models_py3 import BlobServiceItems -from ._models_py3 import BlobServiceProperties -from ._models_py3 import ChangeFeed -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CloudErrorBody -from ._models_py3 import CorsRule -from ._models_py3 import CorsRules -from ._models_py3 import CustomDomain -from ._models_py3 import DateAfterCreation -from ._models_py3 import DateAfterModification -from ._models_py3 import DeleteRetentionPolicy -from ._models_py3 import DeletedAccount -from ._models_py3 import DeletedAccountListResult -from ._models_py3 import DeletedShare -from ._models_py3 import Dimension -from ._models_py3 import Encryption -from ._models_py3 import EncryptionIdentity -from ._models_py3 import EncryptionScope -from ._models_py3 import EncryptionScopeKeyVaultProperties -from ._models_py3 import EncryptionScopeListResult -from ._models_py3 import EncryptionService -from ._models_py3 import EncryptionServices -from ._models_py3 import Endpoints -from ._models_py3 import ErrorResponse -from ._models_py3 import ErrorResponseBody -from ._models_py3 import ExtendedLocation -from ._models_py3 import FileServiceItems -from ._models_py3 import FileServiceProperties -from ._models_py3 import FileShare -from ._models_py3 import FileShareItem -from ._models_py3 import FileShareItems -from ._models_py3 import GeoReplicationStats -from ._models_py3 import IPRule -from ._models_py3 import Identity -from ._models_py3 import ImmutabilityPolicy -from ._models_py3 import ImmutabilityPolicyProperties -from ._models_py3 import ImmutableStorageAccount -from ._models_py3 import ImmutableStorageWithVersioning -from ._models_py3 import KeyCreationTime -from ._models_py3 import KeyPolicy -from ._models_py3 import KeyVaultProperties -from ._models_py3 import LastAccessTimeTrackingPolicy -from ._models_py3 import LeaseContainerRequest -from ._models_py3 import LeaseContainerResponse -from ._models_py3 import LeaseShareRequest -from ._models_py3 import LeaseShareResponse -from ._models_py3 import LegalHold -from ._models_py3 import LegalHoldProperties -from ._models_py3 import ListAccountSasResponse -from ._models_py3 import ListBlobInventoryPolicy -from ._models_py3 import ListContainerItem -from ._models_py3 import ListContainerItems -from ._models_py3 import ListQueue -from ._models_py3 import ListQueueResource -from ._models_py3 import ListQueueServices -from ._models_py3 import ListServiceSasResponse -from ._models_py3 import ListTableResource -from ._models_py3 import ListTableServices -from ._models_py3 import LocalUser -from ._models_py3 import LocalUserKeys -from ._models_py3 import LocalUserRegeneratePasswordResult -from ._models_py3 import LocalUsers -from ._models_py3 import ManagementPolicy -from ._models_py3 import ManagementPolicyAction -from ._models_py3 import ManagementPolicyBaseBlob -from ._models_py3 import ManagementPolicyDefinition -from ._models_py3 import ManagementPolicyFilter -from ._models_py3 import ManagementPolicyRule -from ._models_py3 import ManagementPolicySchema -from ._models_py3 import ManagementPolicySnapShot -from ._models_py3 import ManagementPolicyVersion -from ._models_py3 import MetricSpecification -from ._models_py3 import Multichannel -from ._models_py3 import NetworkRuleSet -from ._models_py3 import ObjectReplicationPolicies -from ._models_py3 import ObjectReplicationPolicy -from ._models_py3 import ObjectReplicationPolicyFilter -from ._models_py3 import ObjectReplicationPolicyRule -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import PermissionScope -from ._models_py3 import PrivateEndpoint -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionListResult -from ._models_py3 import PrivateLinkResource -from ._models_py3 import PrivateLinkResourceListResult -from ._models_py3 import PrivateLinkServiceConnectionState -from ._models_py3 import ProtectedAppendWritesHistory -from ._models_py3 import ProtocolSettings -from ._models_py3 import ProxyResource -from ._models_py3 import QueueServiceProperties -from ._models_py3 import Resource -from ._models_py3 import ResourceAccessRule -from ._models_py3 import RestorePolicyProperties -from ._models_py3 import Restriction -from ._models_py3 import RoutingPreference -from ._models_py3 import SKUCapability -from ._models_py3 import SasPolicy -from ._models_py3 import ServiceSasParameters -from ._models_py3 import ServiceSpecification -from ._models_py3 import SignedIdentifier -from ._models_py3 import Sku -from ._models_py3 import SkuInformation -from ._models_py3 import SmbSetting -from ._models_py3 import SshPublicKey -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountInternetEndpoints -from ._models_py3 import StorageAccountKey -from ._models_py3 import StorageAccountListKeysResult -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountMicrosoftEndpoints -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountSkuConversionStatus -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import StorageQueue -from ._models_py3 import StorageSkuListResult -from ._models_py3 import SystemData -from ._models_py3 import Table -from ._models_py3 import TableAccessPolicy -from ._models_py3 import TableServiceProperties -from ._models_py3 import TableSignedIdentifier -from ._models_py3 import TagFilter -from ._models_py3 import TagProperty -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateHistoryProperty -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName -from ._models_py3 import UserAssignedIdentity -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._storage_management_client_enums import AccessTier -from ._storage_management_client_enums import AccountImmutabilityPolicyState -from ._storage_management_client_enums import AccountStatus -from ._storage_management_client_enums import AccountType -from ._storage_management_client_enums import AllowedCopyScope -from ._storage_management_client_enums import AllowedMethods -from ._storage_management_client_enums import BlobInventoryPolicyName -from ._storage_management_client_enums import BlobRestoreProgressStatus -from ._storage_management_client_enums import Bypass -from ._storage_management_client_enums import CreatedByType -from ._storage_management_client_enums import DefaultAction -from ._storage_management_client_enums import DefaultSharePermission -from ._storage_management_client_enums import DirectoryServiceOptions -from ._storage_management_client_enums import DnsEndpointType -from ._storage_management_client_enums import EnabledProtocols -from ._storage_management_client_enums import EncryptionScopeSource -from ._storage_management_client_enums import EncryptionScopeState -from ._storage_management_client_enums import ExpirationAction -from ._storage_management_client_enums import ExtendedLocationTypes -from ._storage_management_client_enums import Format -from ._storage_management_client_enums import GeoReplicationStatus -from ._storage_management_client_enums import HttpProtocol -from ._storage_management_client_enums import IdentityType -from ._storage_management_client_enums import ImmutabilityPolicyState -from ._storage_management_client_enums import ImmutabilityPolicyUpdateType -from ._storage_management_client_enums import InventoryRuleType -from ._storage_management_client_enums import KeyPermission -from ._storage_management_client_enums import KeySource -from ._storage_management_client_enums import KeyType -from ._storage_management_client_enums import Kind -from ._storage_management_client_enums import LargeFileSharesState -from ._storage_management_client_enums import LeaseContainerRequestEnum -from ._storage_management_client_enums import LeaseDuration -from ._storage_management_client_enums import LeaseShareAction -from ._storage_management_client_enums import LeaseState -from ._storage_management_client_enums import LeaseStatus -from ._storage_management_client_enums import ListContainersInclude -from ._storage_management_client_enums import ListEncryptionScopesInclude -from ._storage_management_client_enums import ManagementPolicyName -from ._storage_management_client_enums import MigrationState -from ._storage_management_client_enums import MinimumTlsVersion -from ._storage_management_client_enums import Name -from ._storage_management_client_enums import ObjectType -from ._storage_management_client_enums import Permissions -from ._storage_management_client_enums import PrivateEndpointConnectionProvisioningState -from ._storage_management_client_enums import PrivateEndpointServiceConnectionStatus -from ._storage_management_client_enums import ProvisioningState -from ._storage_management_client_enums import PublicAccess -from ._storage_management_client_enums import PublicNetworkAccess -from ._storage_management_client_enums import Reason -from ._storage_management_client_enums import ReasonCode -from ._storage_management_client_enums import RootSquashType -from ._storage_management_client_enums import RoutingChoice -from ._storage_management_client_enums import RuleType -from ._storage_management_client_enums import Schedule -from ._storage_management_client_enums import Services -from ._storage_management_client_enums import ShareAccessTier -from ._storage_management_client_enums import SignedResource -from ._storage_management_client_enums import SignedResourceTypes -from ._storage_management_client_enums import SkuConversionStatus -from ._storage_management_client_enums import SkuName -from ._storage_management_client_enums import SkuTier -from ._storage_management_client_enums import State -from ._storage_management_client_enums import StorageAccountExpand -from ._storage_management_client_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccessPolicy, + AccountImmutabilityPolicyProperties, + AccountSasParameters, + ActiveDirectoryProperties, + AzureEntityResource, + AzureFilesIdentityBasedAuthentication, + BlobContainer, + BlobInventoryPolicy, + BlobInventoryPolicyDefinition, + BlobInventoryPolicyFilter, + BlobInventoryPolicyRule, + BlobInventoryPolicySchema, + BlobRestoreParameters, + BlobRestoreRange, + BlobRestoreStatus, + BlobServiceItems, + BlobServiceProperties, + ChangeFeed, + CheckNameAvailabilityResult, + CloudErrorBody, + CorsRule, + CorsRules, + CustomDomain, + DateAfterCreation, + DateAfterModification, + DeleteRetentionPolicy, + DeletedAccount, + DeletedAccountListResult, + DeletedShare, + Dimension, + Encryption, + EncryptionIdentity, + EncryptionScope, + EncryptionScopeKeyVaultProperties, + EncryptionScopeListResult, + EncryptionService, + EncryptionServices, + Endpoints, + ErrorResponse, + ErrorResponseBody, + ExtendedLocation, + FileServiceItems, + FileServiceProperties, + FileShare, + FileShareItem, + FileShareItems, + GeoReplicationStats, + IPRule, + Identity, + ImmutabilityPolicy, + ImmutabilityPolicyProperties, + ImmutableStorageAccount, + ImmutableStorageWithVersioning, + KeyCreationTime, + KeyPolicy, + KeyVaultProperties, + LastAccessTimeTrackingPolicy, + LeaseContainerRequest, + LeaseContainerResponse, + LeaseShareRequest, + LeaseShareResponse, + LegalHold, + LegalHoldProperties, + ListAccountSasResponse, + ListBlobInventoryPolicy, + ListContainerItem, + ListContainerItems, + ListQueue, + ListQueueResource, + ListQueueServices, + ListServiceSasResponse, + ListTableResource, + ListTableServices, + LocalUser, + LocalUserKeys, + LocalUserRegeneratePasswordResult, + LocalUsers, + ManagementPolicy, + ManagementPolicyAction, + ManagementPolicyBaseBlob, + ManagementPolicyDefinition, + ManagementPolicyFilter, + ManagementPolicyRule, + ManagementPolicySchema, + ManagementPolicySnapShot, + ManagementPolicyVersion, + MetricSpecification, + Multichannel, + NetworkRuleSet, + ObjectReplicationPolicies, + ObjectReplicationPolicy, + ObjectReplicationPolicyFilter, + ObjectReplicationPolicyRule, + Operation, + OperationDisplay, + OperationListResult, + PermissionScope, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionListResult, + PrivateLinkResource, + PrivateLinkResourceListResult, + PrivateLinkServiceConnectionState, + ProtectedAppendWritesHistory, + ProtocolSettings, + ProxyResource, + QueueServiceProperties, + Resource, + ResourceAccessRule, + RestorePolicyProperties, + Restriction, + RoutingPreference, + SKUCapability, + SasPolicy, + ServiceSasParameters, + ServiceSpecification, + SignedIdentifier, + Sku, + SkuInformation, + SmbSetting, + SshPublicKey, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountInternetEndpoints, + StorageAccountKey, + StorageAccountListKeysResult, + StorageAccountListResult, + StorageAccountMicrosoftEndpoints, + StorageAccountRegenerateKeyParameters, + StorageAccountSkuConversionStatus, + StorageAccountUpdateParameters, + StorageQueue, + StorageSkuListResult, + SystemData, + Table, + TableAccessPolicy, + TableServiceProperties, + TableSignedIdentifier, + TagFilter, + TagProperty, + TrackedResource, + UpdateHistoryProperty, + Usage, + UsageListResult, + UsageName, + UserAssignedIdentity, + VirtualNetworkRule, +) + +from ._storage_management_client_enums import ( # type: ignore + AccessTier, + AccountImmutabilityPolicyState, + AccountStatus, + AccountType, + AllowedCopyScope, + AllowedMethods, + BlobInventoryPolicyName, + BlobRestoreProgressStatus, + Bypass, + CreatedByType, + DefaultAction, + DefaultSharePermission, + DirectoryServiceOptions, + DnsEndpointType, + EnabledProtocols, + EncryptionScopeSource, + EncryptionScopeState, + ExpirationAction, + ExtendedLocationTypes, + Format, + GeoReplicationStatus, + HttpProtocol, + IdentityType, + ImmutabilityPolicyState, + ImmutabilityPolicyUpdateType, + InventoryRuleType, + KeyPermission, + KeySource, + KeyType, + Kind, + LargeFileSharesState, + LeaseContainerRequestEnum, + LeaseDuration, + LeaseShareAction, + LeaseState, + LeaseStatus, + ListContainersInclude, + ListEncryptionScopesInclude, + ManagementPolicyName, + MigrationState, + MinimumTlsVersion, + Name, + ObjectType, + Permissions, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProvisioningState, + PublicAccess, + PublicNetworkAccess, + Reason, + ReasonCode, + RootSquashType, + RoutingChoice, + RuleType, + Schedule, + Services, + ShareAccessTier, + SignedResource, + SignedResourceTypes, + SkuConversionStatus, + SkuName, + SkuTier, + State, + StorageAccountExpand, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -439,5 +450,5 @@ "StorageAccountExpand", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/models/_models_py3.py index 15ccd86cf684..c871a5028a2a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,7 +13,6 @@ from ... import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -440,7 +439,7 @@ def __init__( self.default_share_permission = default_share_permission -class BlobContainer(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class BlobContainer(AzureEntityResource): """Properties of the blob container, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -1107,7 +1106,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class BlobServiceProperties(Resource): # pylint: disable=too-many-instance-attributes +class BlobServiceProperties(Resource): """The properties of a storage account’s Blob service. Variables are only populated by the server, and will be ignored when sending a request. @@ -2420,7 +2419,7 @@ def __init__( self.protocol_settings = protocol_settings -class FileShare(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShare(AzureEntityResource): """Properties of the file share, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -2578,7 +2577,7 @@ def __init__( self.snapshot_time = None -class FileShareItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShareItem(AzureEntityResource): """The file share properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -3342,7 +3341,7 @@ class LeaseContainerRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2022_09_01.models.LeaseContainerRequestEnum :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -3381,7 +3380,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2022_09_01.models.LeaseContainerRequestEnum :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -3439,7 +3438,7 @@ class LeaseShareRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2022_09_01.models.LeaseShareAction :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -3478,7 +3477,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2022_09_01.models.LeaseShareAction :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -3676,7 +3675,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class ListContainerItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class ListContainerItem(AzureEntityResource): """The blob container properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -4044,7 +4043,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class LocalUser(Resource): # pylint: disable=too-many-instance-attributes +class LocalUser(Resource): """The local user associated with the storage accounts. Variables are only populated by the server, and will be ignored when sending a request. @@ -5678,7 +5677,7 @@ def __init__( self.expiration_action = expiration_action -class ServiceSasParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ServiceSasParameters(_serialization.Model): """The parameters to list service SAS credentials of a specific resource. All required parameters must be populated in order to send to server. @@ -6112,7 +6111,7 @@ class SshPublicKey(_serialization.Model): :ivar description: Optional. It is used to store the function/usage of the key. :vartype description: str - :ivar key: Ssh public key base64 encoded. The format should be: ':code:`` + :ivar key: Ssh public key base64 encoded. The format should be: '\\ :code:`` :code:``', e.g. ssh-rsa AAAABBBB. :vartype key: str """ @@ -6126,7 +6125,7 @@ def __init__(self, *, description: Optional[str] = None, key: Optional[str] = No """ :keyword description: Optional. It is used to store the function/usage of the key. :paramtype description: str - :keyword key: Ssh public key base64 encoded. The format should be: ':code:`` + :keyword key: Ssh public key base64 encoded. The format should be: '\\ :code:`` :code:``', e.g. ssh-rsa AAAABBBB. :paramtype key: str """ @@ -6184,7 +6183,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class StorageAccount(TrackedResource): # pylint: disable=too-many-instance-attributes +class StorageAccount(TrackedResource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. @@ -6604,7 +6603,7 @@ def __init__(self, *, name: str, **kwargs: Any) -> None: self.name = name -class StorageAccountCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountCreateParameters(_serialization.Model): """The parameters used when creating a storage account. All required parameters must be populated in order to send to server. @@ -7173,7 +7172,7 @@ def __init__(self, *, target_sku_name: Optional[Union[str, "_models.SkuName"]] = self.end_time = None -class StorageAccountUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountUpdateParameters(_serialization.Model): """The parameters that can be provided when updating the storage account properties. :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/models/_storage_management_client_enums.py index 05a30001df5c..2b474bb82436 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/models/_storage_management_client_enums.py @@ -292,6 +292,7 @@ class LeaseContainerRequestEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" @@ -311,6 +312,7 @@ class LeaseShareAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/__init__.py index bbce85749d18..a0549517e087 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/__init__.py @@ -5,30 +5,36 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._local_users_operations import LocalUsersOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._local_users_operations import LocalUsersOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -53,5 +59,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_blob_containers_operations.py index 75c73ec453bb..c3095b1074c3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -649,7 +649,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -671,7 +671,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -687,7 +686,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -822,7 +820,7 @@ def create( :rtype: ~azure.mgmt.storage.v2022_09_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -857,7 +855,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -871,11 +868,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -985,7 +978,7 @@ def update( :rtype: ~azure.mgmt.storage.v2022_09_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1020,7 +1013,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1034,7 +1026,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1063,7 +1055,7 @@ def get( :rtype: ~azure.mgmt.storage.v2022_09_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1086,7 +1078,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1100,7 +1091,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1129,7 +1120,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1152,7 +1143,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1275,7 +1265,7 @@ def set_legal_hold( :rtype: ~azure.mgmt.storage.v2022_09_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1310,7 +1300,6 @@ def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1324,7 +1313,7 @@ def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1434,7 +1423,7 @@ def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2022_09_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1469,7 +1458,6 @@ def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1483,7 +1471,7 @@ def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1610,7 +1598,7 @@ def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1651,7 +1639,6 @@ def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1668,7 +1655,7 @@ def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1707,7 +1694,7 @@ def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1733,7 +1720,6 @@ def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1750,7 +1736,7 @@ def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1786,7 +1772,7 @@ def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1812,7 +1798,6 @@ def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1829,7 +1814,7 @@ def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1863,7 +1848,7 @@ def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1887,7 +1872,6 @@ def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1904,7 +1888,7 @@ def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2034,7 +2018,7 @@ def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2073,7 +2057,6 @@ def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2090,7 +2073,7 @@ def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2200,7 +2183,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2022_09_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2238,7 +2221,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2252,17 +2234,17 @@ def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _object_level_worm_initial( # pylint: disable=inconsistent-return-statements + def _object_level_worm_initial( self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2274,7 +2256,7 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_object_level_worm_request( resource_group_name=resource_group_name, @@ -2285,10 +2267,10 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2296,11 +2278,19 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_object_level_worm( @@ -2336,7 +2326,7 @@ def begin_object_level_worm( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._object_level_worm_initial( # type: ignore + raw_result = self._object_level_worm_initial( resource_group_name=resource_group_name, account_name=account_name, container_name=container_name, @@ -2346,6 +2336,7 @@ def begin_object_level_worm( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_blob_inventory_policies_operations.py index 1600eabec091..a52ee9e0a6ed 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -235,7 +232,7 @@ def get( :rtype: ~azure.mgmt.storage.v2022_09_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +255,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -272,7 +268,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -376,7 +372,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2022_09_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,7 +407,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -425,7 +420,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -457,7 +452,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -480,7 +475,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -521,7 +515,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -540,7 +534,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -556,7 +549,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_blob_services_operations.py index 2e773ea84b23..c95fd810bd69 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -191,7 +188,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -210,7 +207,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -226,7 +222,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -343,7 +338,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2022_09_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -379,7 +374,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -393,7 +387,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -418,7 +412,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2022_09_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -442,7 +436,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -456,7 +449,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_deleted_accounts_operations.py index 1eb70e4d45f0..262bf79b3210 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -130,7 +127,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.DeletedAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -147,7 +144,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -163,7 +159,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -205,7 +200,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model :rtype: ~azure.mgmt.storage.v2022_09_01.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +222,6 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -242,7 +236,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_encryption_scopes_operations.py index aeaf8d7fc2f7..bd57a81e5c41 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -330,7 +327,7 @@ def put( :rtype: ~azure.mgmt.storage.v2022_09_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -365,7 +362,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -380,11 +376,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -494,7 +486,7 @@ def patch( :rtype: ~azure.mgmt.storage.v2022_09_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -529,7 +521,6 @@ def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -544,7 +535,7 @@ def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -573,7 +564,7 @@ def get( :rtype: ~azure.mgmt.storage.v2022_09_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -596,7 +587,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -611,7 +601,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -656,7 +646,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -678,7 +668,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -694,7 +683,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_file_services_operations.py index f352f4a97529..6a2bf12ad04c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -179,7 +176,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2022_09_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -310,7 +306,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2022_09_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +342,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -360,7 +355,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -385,7 +380,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2022_09_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -409,7 +404,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -423,7 +417,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_file_shares_operations.py index 9160249c81b1..0f5dcf6e8abd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_file_shares_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -401,7 +399,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +421,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -439,7 +436,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -586,7 +582,7 @@ def create( :rtype: ~azure.mgmt.storage.v2022_09_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -622,7 +618,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -636,11 +631,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -750,7 +741,7 @@ def update( :rtype: ~azure.mgmt.storage.v2022_09_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -785,7 +776,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -799,7 +789,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -840,7 +830,7 @@ def get( :rtype: ~azure.mgmt.storage.v2022_09_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -865,7 +855,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -879,7 +868,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -924,7 +913,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -949,7 +938,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -967,7 +955,7 @@ def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -1002,7 +990,7 @@ def restore( # pylint: disable=inconsistent-return-statements """ @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -1065,7 +1053,7 @@ def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1100,7 +1088,6 @@ def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1232,7 +1219,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2022_09_01.models.LeaseShareResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1271,7 +1258,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1288,7 +1274,7 @@ def lease( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("LeaseShareResponse", pipeline_response) + deserialized = self._deserialize("LeaseShareResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_local_users_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_local_users_operations.py index c87ffc0778fc..b6bb7deaaf55 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_local_users_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_local_users_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -287,7 +284,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.LocalUsers] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +303,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -322,7 +318,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -370,7 +365,7 @@ def get(self, resource_group_name: str, account_name: str, username: str, **kwar :rtype: ~azure.mgmt.storage.v2022_09_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -393,7 +388,6 @@ def get(self, resource_group_name: str, account_name: str, username: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -408,7 +402,7 @@ def get(self, resource_group_name: str, account_name: str, username: str, **kwar error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -509,7 +503,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2022_09_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -544,7 +538,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -559,7 +552,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -586,7 +579,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -609,7 +602,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -647,7 +639,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2022_09_01.models.LocalUserKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -670,7 +662,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -685,7 +676,7 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserKeys", pipeline_response) + deserialized = self._deserialize("LocalUserKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -712,7 +703,7 @@ def regenerate_password( :rtype: ~azure.mgmt.storage.v2022_09_01.models.LocalUserRegeneratePasswordResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -735,7 +726,6 @@ def regenerate_password( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -750,7 +740,7 @@ def regenerate_password( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response) + deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_management_policies_operations.py index 08c55a2eae73..529eac743099 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -196,7 +193,7 @@ def get( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,7 +216,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -233,7 +229,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +333,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +368,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -386,7 +381,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -418,7 +413,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -441,7 +436,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_object_replication_policies_operations.py index eacfc0817ecb..cccce083cdb8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -229,7 +226,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -248,7 +245,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -264,7 +260,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -316,7 +311,7 @@ def get( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -339,7 +334,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +348,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +458,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +493,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -514,7 +507,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -543,7 +536,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +559,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_operations.py index a54571d70cb4..7b10081a6f11 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -126,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_private_endpoint_connections_operations.py index a6bcca87c0b0..a1549d4c4416 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -241,7 +238,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,7 +257,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -276,7 +272,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -325,7 +320,7 @@ def get( :rtype: ~azure.mgmt.storage.v2022_09_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +343,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -363,7 +357,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -464,7 +458,7 @@ def put( :rtype: ~azure.mgmt.storage.v2022_09_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +493,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -514,7 +507,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -541,7 +534,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -564,7 +557,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_private_link_resources_operations.py index f8dfe3fadf52..c8be8f462294 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -109,7 +106,7 @@ def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2022_09_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -131,7 +128,6 @@ def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -145,7 +141,7 @@ def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_queue_operations.py index 20739e8bfbf5..13a958a73824 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -375,7 +372,7 @@ def create( :rtype: ~azure.mgmt.storage.v2022_09_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -410,7 +407,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -424,7 +420,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -531,7 +527,7 @@ def update( :rtype: ~azure.mgmt.storage.v2022_09_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +562,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -580,7 +575,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -607,7 +602,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw :rtype: ~azure.mgmt.storage.v2022_09_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -630,7 +625,6 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -644,7 +638,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -673,7 +667,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -696,7 +690,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -747,7 +740,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -768,7 +761,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -784,7 +776,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_queue_services_operations.py index e934ba9fafa1..0c14e8c73fe5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -179,7 +176,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2022_09_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -310,7 +306,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2022_09_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +342,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -360,7 +355,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -385,7 +380,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2022_09_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -409,7 +404,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -423,7 +417,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_skus_operations.py index ae4341f2b3af..8d6ceb923e43 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_storage_accounts_operations.py index 0f38de305e79..d6aadb1e89f5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -656,7 +656,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2022_09_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -688,7 +688,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -702,7 +701,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -715,8 +714,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -729,7 +728,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -750,10 +749,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -761,12 +760,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -889,10 +890,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -931,7 +933,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -953,7 +955,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -998,7 +999,7 @@ def get_properties( :rtype: ~azure.mgmt.storage.v2022_09_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1021,7 +1022,6 @@ def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1035,7 +1035,7 @@ def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1146,7 +1146,7 @@ def update( :rtype: ~azure.mgmt.storage.v2022_09_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1180,7 +1180,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1194,7 +1193,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1216,7 +1215,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1233,7 +1232,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1249,7 +1247,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1296,7 +1293,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1314,7 +1311,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1330,7 +1326,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1380,7 +1375,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2022_09_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1403,7 +1398,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1417,7 +1411,7 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1511,7 +1505,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2022_09_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1545,7 +1539,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1559,7 +1552,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1650,7 +1643,7 @@ def list_account_sas( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1684,7 +1677,6 @@ def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1698,7 +1690,7 @@ def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1787,7 +1779,7 @@ def list_service_sas( :rtype: ~azure.mgmt.storage.v2022_09_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1821,7 +1813,6 @@ def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1835,17 +1826,17 @@ def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _failover_initial( # pylint: disable=inconsistent-return-statements + def _failover_initial( self, resource_group_name: str, account_name: str, failover_type: Literal["Planned"] = "Planned", **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1857,7 +1848,7 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1868,10 +1859,10 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1879,11 +1870,19 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_failover( @@ -1924,7 +1923,7 @@ def begin_failover( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._failover_initial( # type: ignore + raw_result = self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, failover_type=failover_type, @@ -1934,6 +1933,7 @@ def begin_failover( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1957,10 +1957,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, request_type: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1972,7 +1972,7 @@ def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-r _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -1983,10 +1983,10 @@ def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1994,12 +1994,20 @@ def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_hierarchical_namespace_migration( @@ -2032,7 +2040,7 @@ def begin_hierarchical_namespace_migration( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._hierarchical_namespace_migration_initial( # type: ignore + raw_result = self._hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, request_type=request_type, @@ -2042,6 +2050,7 @@ def begin_hierarchical_namespace_migration( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2065,10 +2074,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _abort_hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2080,7 +2089,7 @@ def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_abort_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -2090,10 +2099,10 @@ def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2101,12 +2110,20 @@ def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-long @@ -2134,7 +2151,7 @@ def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-lo lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._abort_hierarchical_namespace_migration_initial( # type: ignore + raw_result = self._abort_hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -2143,6 +2160,7 @@ def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-lo params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2172,8 +2190,8 @@ def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2186,7 +2204,7 @@ def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2207,10 +2225,10 @@ def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2218,14 +2236,14 @@ def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2338,10 +2356,11 @@ def begin_restore_blob_ranges( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2382,7 +2401,7 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2404,7 +2423,6 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_table_operations.py index 2052cc10020d..838812f95c6a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -340,7 +337,7 @@ def create( :rtype: ~azure.mgmt.storage.v2022_09_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -378,7 +375,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -392,7 +388,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -496,7 +492,7 @@ def update( :rtype: ~azure.mgmt.storage.v2022_09_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -534,7 +530,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -548,7 +543,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -574,7 +569,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw :rtype: ~azure.mgmt.storage.v2022_09_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -597,7 +592,6 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -611,7 +605,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -639,7 +633,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -662,7 +656,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -700,7 +693,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -719,7 +712,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -735,7 +727,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_table_services_operations.py index 2bd19f912f02..6b2a38ea35bf 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -179,7 +176,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2022_09_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -310,7 +306,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2022_09_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +342,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -360,7 +355,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -385,7 +380,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2022_09_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -409,7 +404,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -423,7 +417,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_usages_operations.py index b5c9e5fcb472..5e2f74b764a4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2022_09_01/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -105,7 +102,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.Us api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-09-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -139,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/__init__.py index a860a5c185c9..60980065e1ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/_configuration.py index 039fbf2b172c..cd50c9b357c3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/_metadata.json index 104502301b8d..0a31caef7770 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/_storage_management_client.py index 9df6c2ea2965..02367cd45949 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -41,11 +42,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -217,7 +217,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/_version.py index 5a163c0afedc..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" \ No newline at end of file +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/__init__.py index a5c3d2414cfd..ee2b940bd4fc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/_configuration.py index ec66fb14632d..e722170b52be 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/_storage_management_client.py index b92ea86627c1..a651b415aab7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -41,11 +42,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar operations: Operations operations @@ -222,7 +222,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/__init__.py index bbce85749d18..a0549517e087 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/__init__.py @@ -5,30 +5,36 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._local_users_operations import LocalUsersOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._local_users_operations import LocalUsersOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -53,5 +59,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_blob_containers_operations.py index 609bf13aeb4a..acfab49f84ca 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_containers_operations import ( build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, @@ -52,7 +65,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -117,7 +130,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -139,7 +152,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -155,7 +167,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -290,7 +301,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2023_01_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -325,7 +336,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -339,11 +349,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -453,7 +459,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2023_01_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -488,7 +494,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -502,7 +507,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -531,7 +536,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2023_01_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -554,7 +559,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -568,7 +572,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -576,9 +580,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -597,7 +599,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -620,7 +622,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -743,7 +744,7 @@ async def set_legal_hold( :rtype: ~azure.mgmt.storage.v2023_01_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -778,7 +779,6 @@ async def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -792,7 +792,7 @@ async def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -902,7 +902,7 @@ async def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2023_01_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -937,7 +937,6 @@ async def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -951,7 +950,7 @@ async def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1078,7 +1077,7 @@ async def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1119,7 +1118,6 @@ async def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1136,7 +1134,7 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1175,7 +1173,7 @@ async def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1201,7 +1199,6 @@ async def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1218,7 +1215,7 @@ async def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1254,7 +1251,7 @@ async def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1280,7 +1277,6 @@ async def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1297,7 +1293,7 @@ async def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1331,7 +1327,7 @@ async def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1355,7 +1351,6 @@ async def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1372,7 +1367,7 @@ async def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1502,7 +1497,7 @@ async def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1541,7 +1536,6 @@ async def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1558,7 +1552,7 @@ async def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1668,7 +1662,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2023_01_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1706,7 +1700,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1720,17 +1713,17 @@ async def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _object_level_worm_initial( # pylint: disable=inconsistent-return-statements + async def _object_level_worm_initial( self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1742,7 +1735,7 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_object_level_worm_request( resource_group_name=resource_group_name, @@ -1753,10 +1746,10 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1764,11 +1757,19 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_object_level_worm( @@ -1804,7 +1805,7 @@ async def begin_object_level_worm( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._object_level_worm_initial( # type: ignore + raw_result = await self._object_level_worm_initial( resource_group_name=resource_group_name, account_name=account_name, container_name=container_name, @@ -1814,6 +1815,7 @@ async def begin_object_level_worm( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_blob_inventory_policies_operations.py index e7b4a5128f2c..d0b958882415 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_inventory_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2023_01_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,7 +110,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -127,7 +123,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -231,7 +227,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2023_01_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -266,7 +262,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -280,7 +275,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -288,7 +283,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -312,7 +307,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -335,7 +330,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -376,7 +370,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -395,7 +389,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -411,7 +404,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_blob_services_operations.py index 8e56182c22ce..08b563443a16 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_services_operations import ( build_get_service_properties_request, build_list_request, @@ -39,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +86,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -241,7 +236,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2023_01_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -277,7 +272,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -291,7 +285,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -316,7 +310,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2023_01_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -340,7 +334,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +347,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_deleted_accounts_operations.py index c6b0f623c4fe..c924280d553b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,21 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_accounts_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DeletedAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +88,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -107,7 +103,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -149,7 +144,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> :rtype: ~azure.mgmt.storage.v2023_01_01.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +166,6 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -186,7 +180,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_encryption_scopes_operations.py index ebabd468b62e..e548a6deed7f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._encryption_scopes_operations import ( build_get_request, build_list_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -173,7 +170,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2023_01_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +205,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -223,11 +219,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +329,7 @@ async def patch( :rtype: ~azure.mgmt.storage.v2023_01_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +364,6 @@ async def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -387,7 +378,7 @@ async def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -416,7 +407,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2023_01_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -439,7 +430,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -454,7 +444,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -500,7 +490,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -522,7 +512,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -538,7 +527,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_file_services_operations.py index ec0d02d3c212..f346e86578db 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2023_01_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -207,7 +203,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2023_01_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +239,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -257,7 +252,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -282,7 +277,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2023_01_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +301,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -320,7 +314,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_file_shares_operations.py index 3df4714f2ab4..2161463b5a2f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_file_shares_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_shares_operations import ( build_create_request, build_delete_request, @@ -43,7 +40,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -108,7 +105,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -130,7 +127,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -146,7 +142,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -293,7 +288,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2023_01_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -329,7 +324,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -343,11 +337,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -457,7 +447,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2023_01_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -492,7 +482,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -506,7 +495,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -547,7 +536,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2023_01_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -572,7 +561,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -586,7 +574,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -594,7 +582,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -631,7 +619,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -656,7 +644,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -674,7 +661,7 @@ async def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -709,7 +696,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -744,7 +731,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -772,7 +759,7 @@ async def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -807,7 +794,6 @@ async def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -939,7 +925,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2023_01_01.models.LeaseShareResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -978,7 +964,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -995,7 +980,7 @@ async def lease( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("LeaseShareResponse", pipeline_response) + deserialized = self._deserialize("LeaseShareResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_local_users_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_local_users_operations.py index 9247f364aa52..b498d9a6674a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_local_users_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_local_users_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._local_users_operations import ( build_create_or_update_request, build_delete_request, @@ -42,7 +39,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +86,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.LocalUsers] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -172,7 +167,7 @@ async def get(self, resource_group_name: str, account_name: str, username: str, :rtype: ~azure.mgmt.storage.v2023_01_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -195,7 +190,6 @@ async def get(self, resource_group_name: str, account_name: str, username: str, headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -210,7 +204,7 @@ async def get(self, resource_group_name: str, account_name: str, username: str, error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -311,7 +305,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2023_01_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +340,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -361,7 +354,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -369,9 +362,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, username: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, username: str, **kwargs: Any) -> None: """Deletes the local user associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -388,7 +379,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,7 +402,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -449,7 +439,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2023_01_01.models.LocalUserKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -472,7 +462,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -487,7 +476,7 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserKeys", pipeline_response) + deserialized = self._deserialize("LocalUserKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -514,7 +503,7 @@ async def regenerate_password( :rtype: ~azure.mgmt.storage.v2023_01_01.models.LocalUserRegeneratePasswordResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -537,7 +526,6 @@ async def regenerate_password( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -552,7 +540,7 @@ async def regenerate_password( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response) + deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_management_policies_operations.py index 85238c6c925d..bf769be355d4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._management_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +119,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -227,7 +223,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -262,7 +258,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -276,7 +271,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -284,7 +279,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -308,7 +303,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +326,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_object_replication_policies_operations.py index 0bfccfc3eb83..62bab8824dc8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._object_replication_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -177,7 +172,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -200,7 +195,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +209,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -325,7 +319,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -360,7 +354,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -375,7 +368,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -383,7 +376,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, object_replication_policy_id: str, **kwargs: Any ) -> None: """Deletes the object replication policy associated with the specified storage account. @@ -404,7 +397,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +420,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_operations.py index 340332958f52..d2d07edf6f7a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_private_endpoint_connections_operations.py index dc039cadea50..21ad016c64d7 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connections_operations import ( build_delete_request, build_get_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -174,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2023_01_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -197,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -212,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -313,7 +307,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2023_01_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +342,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -363,7 +356,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -371,7 +364,7 @@ async def put( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: """Deletes the specified private endpoint connection associated with the storage account. @@ -390,7 +383,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -413,7 +406,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_private_link_resources_operations.py index a53c1e3b2ba9..f230b455f371 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_by_storage_account_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ async def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2023_01_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,7 +92,6 @@ async def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +105,7 @@ async def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_queue_operations.py index 76048ac11b4a..1c74dc389576 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_operations import ( build_create_request, build_delete_request, @@ -41,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -166,7 +163,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2023_01_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -322,7 +318,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2023_01_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -357,7 +353,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -371,7 +366,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -400,7 +395,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2023_01_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +418,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -437,7 +431,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -445,9 +439,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any) -> None: """Deletes the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -466,7 +458,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -489,7 +481,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -541,7 +532,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -562,7 +553,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -578,7 +568,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_queue_services_operations.py index 86a21a059a17..603b2b741b73 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2023_01_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -207,7 +203,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2023_01_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +239,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -257,7 +252,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -282,7 +277,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2023_01_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +301,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -320,7 +314,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_skus_operations.py index c3a1cda8c096..f1e74725626a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -90,7 +87,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -106,7 +102,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_storage_accounts_operations.py index 0ca5cfed9747..e00c2fcaaf01 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_abort_hierarchical_namespace_migration_request, build_check_name_availability_request, @@ -56,7 +69,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -139,7 +152,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2023_01_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +184,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -185,7 +197,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -198,8 +210,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -212,7 +224,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -233,10 +245,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -244,12 +256,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -375,10 +389,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -401,9 +416,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -417,7 +430,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -439,7 +452,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -484,7 +496,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2023_01_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -507,7 +519,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -521,7 +532,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -632,7 +643,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2023_01_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -666,7 +677,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -680,7 +690,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -703,7 +713,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -720,7 +730,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -736,7 +745,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -786,7 +794,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -804,7 +812,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -820,7 +827,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -870,7 +876,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2023_01_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -893,7 +899,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -907,7 +912,7 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1001,7 +1006,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2023_01_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1035,7 +1040,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1049,7 +1053,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1140,7 +1144,7 @@ async def list_account_sas( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1174,7 +1178,6 @@ async def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1188,7 +1191,7 @@ async def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1277,7 +1280,7 @@ async def list_service_sas( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1311,7 +1314,6 @@ async def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1325,17 +1327,17 @@ async def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _failover_initial( # pylint: disable=inconsistent-return-statements + async def _failover_initial( self, resource_group_name: str, account_name: str, failover_type: Literal["Planned"] = "Planned", **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1347,7 +1349,7 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1358,10 +1360,10 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1369,11 +1371,19 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_failover( @@ -1414,7 +1424,7 @@ async def begin_failover( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._failover_initial( # type: ignore + raw_result = await self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, failover_type=failover_type, @@ -1424,6 +1434,7 @@ async def begin_failover( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1447,10 +1458,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, request_type: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1462,7 +1473,7 @@ async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -1473,10 +1484,10 @@ async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1484,12 +1495,20 @@ async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_hierarchical_namespace_migration( @@ -1522,7 +1541,7 @@ async def begin_hierarchical_namespace_migration( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._hierarchical_namespace_migration_initial( # type: ignore + raw_result = await self._hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, request_type=request_type, @@ -1532,6 +1551,7 @@ async def begin_hierarchical_namespace_migration( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1555,10 +1575,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1570,7 +1590,7 @@ async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=in _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_abort_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -1580,10 +1600,10 @@ async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=in headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1591,12 +1611,20 @@ async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-long @@ -1624,7 +1652,7 @@ async def begin_abort_hierarchical_namespace_migration( # pylint: disable=name- lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._abort_hierarchical_namespace_migration_initial( # type: ignore + raw_result = await self._abort_hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1633,6 +1661,7 @@ async def begin_abort_hierarchical_namespace_migration( # pylint: disable=name- params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1656,14 +1685,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _customer_initiated_migration_initial( # pylint: disable=inconsistent-return-statements + async def _customer_initiated_migration_initial( self, resource_group_name: str, account_name: str, parameters: Union[_models.StorageAccountMigration, IO[bytes]], **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1676,7 +1705,7 @@ async def _customer_initiated_migration_initial( # pylint: disable=inconsistent api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1697,10 +1726,10 @@ async def _customer_initiated_migration_initial( # pylint: disable=inconsistent headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1708,6 +1737,10 @@ async def _customer_initiated_migration_initial( # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1716,8 +1749,12 @@ async def _customer_initiated_migration_initial( # pylint: disable=inconsistent if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload async def begin_customer_initiated_migration( @@ -1825,7 +1862,7 @@ async def begin_customer_initiated_migration( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._customer_initiated_migration_initial( # type: ignore + raw_result = await self._customer_initiated_migration_initial( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, @@ -1836,6 +1873,7 @@ async def begin_customer_initiated_migration( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1883,7 +1921,7 @@ async def get_customer_initiated_migration( :rtype: ~azure.mgmt.storage.v2023_01_01.models.StorageAccountMigration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1906,7 +1944,6 @@ async def get_customer_initiated_migration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1921,7 +1958,7 @@ async def get_customer_initiated_migration( error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountMigration", pipeline_response) + deserialized = self._deserialize("StorageAccountMigration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1934,8 +1971,8 @@ async def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1948,7 +1985,7 @@ async def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1969,10 +2006,10 @@ async def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1980,14 +2017,14 @@ async def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2103,10 +2140,11 @@ async def begin_restore_blob_ranges( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2131,9 +2169,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def revoke_user_delegation_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -2147,7 +2183,7 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2169,7 +2205,6 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_table_operations.py index 10b995ac5311..cabeed39ae32 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_operations import ( build_create_request, build_delete_request, @@ -41,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -163,7 +160,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2023_01_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -319,7 +315,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2023_01_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -357,7 +353,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -371,7 +366,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -397,7 +392,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str :rtype: ~azure.mgmt.storage.v2023_01_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -420,7 +415,6 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -434,7 +428,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -442,9 +436,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any) -> None: """Deletes the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -462,7 +454,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -485,7 +477,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -523,7 +514,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -542,7 +533,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -558,7 +548,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_table_services_operations.py index e8562a94cca8..da334dce6027 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2023_01_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -207,7 +203,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2023_01_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +239,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -257,7 +252,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -282,7 +277,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2023_01_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +301,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -320,7 +314,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_usages_operations.py index 5ccb6b03a3e0..fea5c1b31d11 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/aio/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usages_operations import build_list_by_location_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +72,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_mode api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -109,7 +105,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/models/__init__.py index ad7f16a1ac36..8a11c6e1dabc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/models/__init__.py @@ -5,232 +5,243 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccessPolicy -from ._models_py3 import AccountImmutabilityPolicyProperties -from ._models_py3 import AccountSasParameters -from ._models_py3 import ActiveDirectoryProperties -from ._models_py3 import AzureEntityResource -from ._models_py3 import AzureFilesIdentityBasedAuthentication -from ._models_py3 import BlobContainer -from ._models_py3 import BlobInventoryCreationTime -from ._models_py3 import BlobInventoryPolicy -from ._models_py3 import BlobInventoryPolicyDefinition -from ._models_py3 import BlobInventoryPolicyFilter -from ._models_py3 import BlobInventoryPolicyRule -from ._models_py3 import BlobInventoryPolicySchema -from ._models_py3 import BlobRestoreParameters -from ._models_py3 import BlobRestoreRange -from ._models_py3 import BlobRestoreStatus -from ._models_py3 import BlobServiceItems -from ._models_py3 import BlobServiceProperties -from ._models_py3 import ChangeFeed -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CloudErrorBody -from ._models_py3 import CorsRule -from ._models_py3 import CorsRules -from ._models_py3 import CustomDomain -from ._models_py3 import DateAfterCreation -from ._models_py3 import DateAfterModification -from ._models_py3 import DeleteRetentionPolicy -from ._models_py3 import DeletedAccount -from ._models_py3 import DeletedAccountListResult -from ._models_py3 import DeletedShare -from ._models_py3 import Dimension -from ._models_py3 import Encryption -from ._models_py3 import EncryptionIdentity -from ._models_py3 import EncryptionScope -from ._models_py3 import EncryptionScopeKeyVaultProperties -from ._models_py3 import EncryptionScopeListResult -from ._models_py3 import EncryptionService -from ._models_py3 import EncryptionServices -from ._models_py3 import Endpoints -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import ErrorResponseAutoGenerated -from ._models_py3 import ErrorResponseBody -from ._models_py3 import ExtendedLocation -from ._models_py3 import FileServiceItems -from ._models_py3 import FileServiceProperties -from ._models_py3 import FileShare -from ._models_py3 import FileShareItem -from ._models_py3 import FileShareItems -from ._models_py3 import GeoReplicationStats -from ._models_py3 import IPRule -from ._models_py3 import Identity -from ._models_py3 import ImmutabilityPolicy -from ._models_py3 import ImmutabilityPolicyProperties -from ._models_py3 import ImmutableStorageAccount -from ._models_py3 import ImmutableStorageWithVersioning -from ._models_py3 import KeyCreationTime -from ._models_py3 import KeyPolicy -from ._models_py3 import KeyVaultProperties -from ._models_py3 import LastAccessTimeTrackingPolicy -from ._models_py3 import LeaseContainerRequest -from ._models_py3 import LeaseContainerResponse -from ._models_py3 import LeaseShareRequest -from ._models_py3 import LeaseShareResponse -from ._models_py3 import LegalHold -from ._models_py3 import LegalHoldProperties -from ._models_py3 import ListAccountSasResponse -from ._models_py3 import ListBlobInventoryPolicy -from ._models_py3 import ListContainerItem -from ._models_py3 import ListContainerItems -from ._models_py3 import ListQueue -from ._models_py3 import ListQueueResource -from ._models_py3 import ListQueueServices -from ._models_py3 import ListServiceSasResponse -from ._models_py3 import ListTableResource -from ._models_py3 import ListTableServices -from ._models_py3 import LocalUser -from ._models_py3 import LocalUserKeys -from ._models_py3 import LocalUserRegeneratePasswordResult -from ._models_py3 import LocalUsers -from ._models_py3 import ManagementPolicy -from ._models_py3 import ManagementPolicyAction -from ._models_py3 import ManagementPolicyBaseBlob -from ._models_py3 import ManagementPolicyDefinition -from ._models_py3 import ManagementPolicyFilter -from ._models_py3 import ManagementPolicyRule -from ._models_py3 import ManagementPolicySchema -from ._models_py3 import ManagementPolicySnapShot -from ._models_py3 import ManagementPolicyVersion -from ._models_py3 import MetricSpecification -from ._models_py3 import Multichannel -from ._models_py3 import NetworkRuleSet -from ._models_py3 import ObjectReplicationPolicies -from ._models_py3 import ObjectReplicationPolicy -from ._models_py3 import ObjectReplicationPolicyFilter -from ._models_py3 import ObjectReplicationPolicyRule -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import PermissionScope -from ._models_py3 import PrivateEndpoint -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionListResult -from ._models_py3 import PrivateLinkResource -from ._models_py3 import PrivateLinkResourceListResult -from ._models_py3 import PrivateLinkServiceConnectionState -from ._models_py3 import ProtectedAppendWritesHistory -from ._models_py3 import ProtocolSettings -from ._models_py3 import ProxyResource -from ._models_py3 import QueueServiceProperties -from ._models_py3 import Resource -from ._models_py3 import ResourceAccessRule -from ._models_py3 import RestorePolicyProperties -from ._models_py3 import Restriction -from ._models_py3 import RoutingPreference -from ._models_py3 import SKUCapability -from ._models_py3 import SasPolicy -from ._models_py3 import ServiceSasParameters -from ._models_py3 import ServiceSpecification -from ._models_py3 import SignedIdentifier -from ._models_py3 import Sku -from ._models_py3 import SkuInformation -from ._models_py3 import SmbSetting -from ._models_py3 import SshPublicKey -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountInternetEndpoints -from ._models_py3 import StorageAccountKey -from ._models_py3 import StorageAccountListKeysResult -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountMicrosoftEndpoints -from ._models_py3 import StorageAccountMigration -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountSkuConversionStatus -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import StorageQueue -from ._models_py3 import StorageSkuListResult -from ._models_py3 import SystemData -from ._models_py3 import Table -from ._models_py3 import TableAccessPolicy -from ._models_py3 import TableServiceProperties -from ._models_py3 import TableSignedIdentifier -from ._models_py3 import TagFilter -from ._models_py3 import TagProperty -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateHistoryProperty -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName -from ._models_py3 import UserAssignedIdentity -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._storage_management_client_enums import AccessTier -from ._storage_management_client_enums import AccountImmutabilityPolicyState -from ._storage_management_client_enums import AccountStatus -from ._storage_management_client_enums import AccountType -from ._storage_management_client_enums import AllowedCopyScope -from ._storage_management_client_enums import AllowedMethods -from ._storage_management_client_enums import BlobInventoryPolicyName -from ._storage_management_client_enums import BlobRestoreProgressStatus -from ._storage_management_client_enums import Bypass -from ._storage_management_client_enums import CreatedByType -from ._storage_management_client_enums import DefaultAction -from ._storage_management_client_enums import DefaultSharePermission -from ._storage_management_client_enums import DirectoryServiceOptions -from ._storage_management_client_enums import DnsEndpointType -from ._storage_management_client_enums import EnabledProtocols -from ._storage_management_client_enums import EncryptionScopeSource -from ._storage_management_client_enums import EncryptionScopeState -from ._storage_management_client_enums import ExpirationAction -from ._storage_management_client_enums import ExtendedLocationTypes -from ._storage_management_client_enums import Format -from ._storage_management_client_enums import GeoReplicationStatus -from ._storage_management_client_enums import HttpProtocol -from ._storage_management_client_enums import IdentityType -from ._storage_management_client_enums import ImmutabilityPolicyState -from ._storage_management_client_enums import ImmutabilityPolicyUpdateType -from ._storage_management_client_enums import InventoryRuleType -from ._storage_management_client_enums import KeyPermission -from ._storage_management_client_enums import KeySource -from ._storage_management_client_enums import KeyType -from ._storage_management_client_enums import Kind -from ._storage_management_client_enums import LargeFileSharesState -from ._storage_management_client_enums import LeaseContainerRequestEnum -from ._storage_management_client_enums import LeaseDuration -from ._storage_management_client_enums import LeaseShareAction -from ._storage_management_client_enums import LeaseState -from ._storage_management_client_enums import LeaseStatus -from ._storage_management_client_enums import ListContainersInclude -from ._storage_management_client_enums import ListEncryptionScopesInclude -from ._storage_management_client_enums import ManagementPolicyName -from ._storage_management_client_enums import MigrationName -from ._storage_management_client_enums import MigrationState -from ._storage_management_client_enums import MigrationStatus -from ._storage_management_client_enums import MinimumTlsVersion -from ._storage_management_client_enums import Name -from ._storage_management_client_enums import ObjectType -from ._storage_management_client_enums import Permissions -from ._storage_management_client_enums import PostFailoverRedundancy -from ._storage_management_client_enums import PostPlannedFailoverRedundancy -from ._storage_management_client_enums import PrivateEndpointConnectionProvisioningState -from ._storage_management_client_enums import PrivateEndpointServiceConnectionStatus -from ._storage_management_client_enums import ProvisioningState -from ._storage_management_client_enums import PublicAccess -from ._storage_management_client_enums import PublicNetworkAccess -from ._storage_management_client_enums import Reason -from ._storage_management_client_enums import ReasonCode -from ._storage_management_client_enums import RootSquashType -from ._storage_management_client_enums import RoutingChoice -from ._storage_management_client_enums import RuleType -from ._storage_management_client_enums import Schedule -from ._storage_management_client_enums import Services -from ._storage_management_client_enums import ShareAccessTier -from ._storage_management_client_enums import SignedResource -from ._storage_management_client_enums import SignedResourceTypes -from ._storage_management_client_enums import SkuConversionStatus -from ._storage_management_client_enums import SkuName -from ._storage_management_client_enums import SkuTier -from ._storage_management_client_enums import State -from ._storage_management_client_enums import StorageAccountExpand -from ._storage_management_client_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccessPolicy, + AccountImmutabilityPolicyProperties, + AccountSasParameters, + ActiveDirectoryProperties, + AzureEntityResource, + AzureFilesIdentityBasedAuthentication, + BlobContainer, + BlobInventoryCreationTime, + BlobInventoryPolicy, + BlobInventoryPolicyDefinition, + BlobInventoryPolicyFilter, + BlobInventoryPolicyRule, + BlobInventoryPolicySchema, + BlobRestoreParameters, + BlobRestoreRange, + BlobRestoreStatus, + BlobServiceItems, + BlobServiceProperties, + ChangeFeed, + CheckNameAvailabilityResult, + CloudErrorBody, + CorsRule, + CorsRules, + CustomDomain, + DateAfterCreation, + DateAfterModification, + DeleteRetentionPolicy, + DeletedAccount, + DeletedAccountListResult, + DeletedShare, + Dimension, + Encryption, + EncryptionIdentity, + EncryptionScope, + EncryptionScopeKeyVaultProperties, + EncryptionScopeListResult, + EncryptionService, + EncryptionServices, + Endpoints, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + ErrorResponseAutoGenerated, + ErrorResponseBody, + ExtendedLocation, + FileServiceItems, + FileServiceProperties, + FileShare, + FileShareItem, + FileShareItems, + GeoReplicationStats, + IPRule, + Identity, + ImmutabilityPolicy, + ImmutabilityPolicyProperties, + ImmutableStorageAccount, + ImmutableStorageWithVersioning, + KeyCreationTime, + KeyPolicy, + KeyVaultProperties, + LastAccessTimeTrackingPolicy, + LeaseContainerRequest, + LeaseContainerResponse, + LeaseShareRequest, + LeaseShareResponse, + LegalHold, + LegalHoldProperties, + ListAccountSasResponse, + ListBlobInventoryPolicy, + ListContainerItem, + ListContainerItems, + ListQueue, + ListQueueResource, + ListQueueServices, + ListServiceSasResponse, + ListTableResource, + ListTableServices, + LocalUser, + LocalUserKeys, + LocalUserRegeneratePasswordResult, + LocalUsers, + ManagementPolicy, + ManagementPolicyAction, + ManagementPolicyBaseBlob, + ManagementPolicyDefinition, + ManagementPolicyFilter, + ManagementPolicyRule, + ManagementPolicySchema, + ManagementPolicySnapShot, + ManagementPolicyVersion, + MetricSpecification, + Multichannel, + NetworkRuleSet, + ObjectReplicationPolicies, + ObjectReplicationPolicy, + ObjectReplicationPolicyFilter, + ObjectReplicationPolicyRule, + Operation, + OperationDisplay, + OperationListResult, + PermissionScope, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionListResult, + PrivateLinkResource, + PrivateLinkResourceListResult, + PrivateLinkServiceConnectionState, + ProtectedAppendWritesHistory, + ProtocolSettings, + ProxyResource, + QueueServiceProperties, + Resource, + ResourceAccessRule, + RestorePolicyProperties, + Restriction, + RoutingPreference, + SKUCapability, + SasPolicy, + ServiceSasParameters, + ServiceSpecification, + SignedIdentifier, + Sku, + SkuInformation, + SmbSetting, + SshPublicKey, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountInternetEndpoints, + StorageAccountKey, + StorageAccountListKeysResult, + StorageAccountListResult, + StorageAccountMicrosoftEndpoints, + StorageAccountMigration, + StorageAccountRegenerateKeyParameters, + StorageAccountSkuConversionStatus, + StorageAccountUpdateParameters, + StorageQueue, + StorageSkuListResult, + SystemData, + Table, + TableAccessPolicy, + TableServiceProperties, + TableSignedIdentifier, + TagFilter, + TagProperty, + TrackedResource, + UpdateHistoryProperty, + Usage, + UsageListResult, + UsageName, + UserAssignedIdentity, + VirtualNetworkRule, +) + +from ._storage_management_client_enums import ( # type: ignore + AccessTier, + AccountImmutabilityPolicyState, + AccountStatus, + AccountType, + AllowedCopyScope, + AllowedMethods, + BlobInventoryPolicyName, + BlobRestoreProgressStatus, + Bypass, + CreatedByType, + DefaultAction, + DefaultSharePermission, + DirectoryServiceOptions, + DnsEndpointType, + EnabledProtocols, + EncryptionScopeSource, + EncryptionScopeState, + ExpirationAction, + ExtendedLocationTypes, + Format, + GeoReplicationStatus, + HttpProtocol, + IdentityType, + ImmutabilityPolicyState, + ImmutabilityPolicyUpdateType, + InventoryRuleType, + KeyPermission, + KeySource, + KeyType, + Kind, + LargeFileSharesState, + LeaseContainerRequestEnum, + LeaseDuration, + LeaseShareAction, + LeaseState, + LeaseStatus, + ListContainersInclude, + ListEncryptionScopesInclude, + ManagementPolicyName, + MigrationName, + MigrationState, + MigrationStatus, + MinimumTlsVersion, + Name, + ObjectType, + Permissions, + PostFailoverRedundancy, + PostPlannedFailoverRedundancy, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProvisioningState, + PublicAccess, + PublicNetworkAccess, + Reason, + ReasonCode, + RootSquashType, + RoutingChoice, + RuleType, + Schedule, + Services, + ShareAccessTier, + SignedResource, + SignedResourceTypes, + SkuConversionStatus, + SkuName, + SkuTier, + State, + StorageAccountExpand, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -457,5 +468,5 @@ "StorageAccountExpand", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/models/_models_py3.py index 64f527dc3fd2..baa970acbf1f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,7 +13,6 @@ from ... import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -440,7 +439,7 @@ def __init__( self.default_share_permission = default_share_permission -class BlobContainer(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class BlobContainer(AzureEntityResource): """Properties of the blob container, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -1142,7 +1141,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class BlobServiceProperties(Resource): # pylint: disable=too-many-instance-attributes +class BlobServiceProperties(Resource): """The properties of a storage account’s Blob service. Variables are only populated by the server, and will be ignored when sending a request. @@ -2547,7 +2546,7 @@ def __init__( self.protocol_settings = protocol_settings -class FileShare(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShare(AzureEntityResource): """Properties of the file share, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -2705,7 +2704,7 @@ def __init__( self.snapshot_time = None -class FileShareItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShareItem(AzureEntityResource): """The file share properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -3490,7 +3489,7 @@ class LeaseContainerRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2023_01_01.models.LeaseContainerRequestEnum :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -3529,7 +3528,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2023_01_01.models.LeaseContainerRequestEnum :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -3587,7 +3586,7 @@ class LeaseShareRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2023_01_01.models.LeaseShareAction :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -3626,7 +3625,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2023_01_01.models.LeaseShareAction :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -3824,7 +3823,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class ListContainerItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class ListContainerItem(AzureEntityResource): """The blob container properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -4192,7 +4191,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class LocalUser(Resource): # pylint: disable=too-many-instance-attributes +class LocalUser(Resource): """The local user associated with the storage accounts. Variables are only populated by the server, and will be ignored when sending a request. @@ -5826,7 +5825,7 @@ def __init__( self.expiration_action = expiration_action -class ServiceSasParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ServiceSasParameters(_serialization.Model): """The parameters to list service SAS credentials of a specific resource. All required parameters must be populated in order to send to server. @@ -6260,7 +6259,7 @@ class SshPublicKey(_serialization.Model): :ivar description: Optional. It is used to store the function/usage of the key. :vartype description: str - :ivar key: Ssh public key base64 encoded. The format should be: ':code:`` + :ivar key: Ssh public key base64 encoded. The format should be: '\\ :code:`` :code:``', e.g. ssh-rsa AAAABBBB. :vartype key: str """ @@ -6274,7 +6273,7 @@ def __init__(self, *, description: Optional[str] = None, key: Optional[str] = No """ :keyword description: Optional. It is used to store the function/usage of the key. :paramtype description: str - :keyword key: Ssh public key base64 encoded. The format should be: ':code:`` + :keyword key: Ssh public key base64 encoded. The format should be: '\\ :code:`` :code:``', e.g. ssh-rsa AAAABBBB. :paramtype key: str """ @@ -6332,7 +6331,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class StorageAccount(TrackedResource): # pylint: disable=too-many-instance-attributes +class StorageAccount(TrackedResource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. @@ -6768,7 +6767,7 @@ def __init__(self, *, name: str, **kwargs: Any) -> None: self.name = name -class StorageAccountCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountCreateParameters(_serialization.Model): """The parameters used when creating a storage account. All required parameters must be populated in order to send to server. @@ -7414,7 +7413,7 @@ def __init__(self, *, target_sku_name: Optional[Union[str, "_models.SkuName"]] = self.end_time = None -class StorageAccountUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountUpdateParameters(_serialization.Model): """The parameters that can be provided when updating the storage account properties. :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/models/_storage_management_client_enums.py index f6a4eb0a48b0..261ed4a5072e 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/models/_storage_management_client_enums.py @@ -294,6 +294,7 @@ class LeaseContainerRequestEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" @@ -313,6 +314,7 @@ class LeaseShareAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/__init__.py index bbce85749d18..a0549517e087 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/__init__.py @@ -5,30 +5,36 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._local_users_operations import LocalUsersOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._local_users_operations import LocalUsersOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -53,5 +59,5 @@ "TableServicesOperations", "TableOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_blob_containers_operations.py index a71a4a713f0a..095948660e08 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -677,7 +677,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -699,7 +699,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -715,7 +714,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -850,7 +848,7 @@ def create( :rtype: ~azure.mgmt.storage.v2023_01_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -885,7 +883,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -899,11 +896,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1013,7 +1006,7 @@ def update( :rtype: ~azure.mgmt.storage.v2023_01_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1048,7 +1041,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1062,7 +1054,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1091,7 +1083,7 @@ def get( :rtype: ~azure.mgmt.storage.v2023_01_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1114,7 +1106,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1128,7 +1119,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1157,7 +1148,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1180,7 +1171,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1303,7 +1293,7 @@ def set_legal_hold( :rtype: ~azure.mgmt.storage.v2023_01_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1338,7 +1328,6 @@ def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1352,7 +1341,7 @@ def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1462,7 +1451,7 @@ def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2023_01_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1497,7 +1486,6 @@ def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1511,7 +1499,7 @@ def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1638,7 +1626,7 @@ def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1679,7 +1667,6 @@ def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1696,7 +1683,7 @@ def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1735,7 +1722,7 @@ def get_immutability_policy( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1761,7 +1748,6 @@ def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1778,7 +1764,7 @@ def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1814,7 +1800,7 @@ def delete_immutability_policy( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1840,7 +1826,6 @@ def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1857,7 +1842,7 @@ def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1891,7 +1876,7 @@ def lock_immutability_policy( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1915,7 +1900,6 @@ def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1932,7 +1916,7 @@ def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2062,7 +2046,7 @@ def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2101,7 +2085,6 @@ def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2118,7 +2101,7 @@ def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2228,7 +2211,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2023_01_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2266,7 +2249,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2280,17 +2262,17 @@ def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _object_level_worm_initial( # pylint: disable=inconsistent-return-statements + def _object_level_worm_initial( self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2302,7 +2284,7 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_object_level_worm_request( resource_group_name=resource_group_name, @@ -2313,10 +2295,10 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2324,11 +2306,19 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_object_level_worm( @@ -2364,7 +2354,7 @@ def begin_object_level_worm( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._object_level_worm_initial( # type: ignore + raw_result = self._object_level_worm_initial( resource_group_name=resource_group_name, account_name=account_name, container_name=container_name, @@ -2374,6 +2364,7 @@ def begin_object_level_worm( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_blob_inventory_policies_operations.py index 519d1b591c98..2bb75ec5ae22 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -243,7 +240,7 @@ def get( :rtype: ~azure.mgmt.storage.v2023_01_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -266,7 +263,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -280,7 +276,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -384,7 +380,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2023_01_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -419,7 +415,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -433,7 +428,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -465,7 +460,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -488,7 +483,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -529,7 +523,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -548,7 +542,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -564,7 +557,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_blob_services_operations.py index 22790f8c0773..a566d61195e4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -197,7 +194,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -216,7 +213,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -232,7 +228,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -349,7 +344,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2023_01_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -385,7 +380,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -399,7 +393,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -424,7 +418,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2023_01_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -448,7 +442,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -462,7 +455,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_deleted_accounts_operations.py index b1309c8fb713..abdd468f9d01 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -130,7 +127,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.DeletedAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -147,7 +144,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -163,7 +159,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -205,7 +200,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model :rtype: ~azure.mgmt.storage.v2023_01_01.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +222,6 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -242,7 +236,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_encryption_scopes_operations.py index 9aab933c2612..a74904e6addc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -338,7 +335,7 @@ def put( :rtype: ~azure.mgmt.storage.v2023_01_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -373,7 +370,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -388,11 +384,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -502,7 +494,7 @@ def patch( :rtype: ~azure.mgmt.storage.v2023_01_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -537,7 +529,6 @@ def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -552,7 +543,7 @@ def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -581,7 +572,7 @@ def get( :rtype: ~azure.mgmt.storage.v2023_01_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -604,7 +595,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -619,7 +609,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -664,7 +654,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -686,7 +676,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -702,7 +691,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_file_services_operations.py index 3dd19e0f6ba9..378098613519 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2023_01_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +204,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -221,7 +217,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -316,7 +312,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2023_01_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -352,7 +348,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -366,7 +361,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -391,7 +386,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2023_01_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -415,7 +410,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -429,7 +423,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_file_shares_operations.py index 193b91228cd6..2ee222f907b3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_file_shares_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -415,7 +413,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -437,7 +435,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -453,7 +450,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -600,7 +596,7 @@ def create( :rtype: ~azure.mgmt.storage.v2023_01_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -636,7 +632,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -650,11 +645,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -764,7 +755,7 @@ def update( :rtype: ~azure.mgmt.storage.v2023_01_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -799,7 +790,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -813,7 +803,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -854,7 +844,7 @@ def get( :rtype: ~azure.mgmt.storage.v2023_01_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -879,7 +869,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -893,7 +882,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -938,7 +927,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -963,7 +952,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -981,7 +969,7 @@ def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -1016,7 +1004,7 @@ def restore( # pylint: disable=inconsistent-return-statements """ @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -1079,7 +1067,7 @@ def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1114,7 +1102,6 @@ def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1246,7 +1233,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2023_01_01.models.LeaseShareResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1285,7 +1272,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1302,7 +1288,7 @@ def lease( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("LeaseShareResponse", pipeline_response) + deserialized = self._deserialize("LeaseShareResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_local_users_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_local_users_operations.py index 3f554e0ed8c7..2edbb539c06a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_local_users_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_local_users_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -299,7 +296,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.LocalUsers] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -318,7 +315,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -334,7 +330,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -382,7 +377,7 @@ def get(self, resource_group_name: str, account_name: str, username: str, **kwar :rtype: ~azure.mgmt.storage.v2023_01_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -405,7 +400,6 @@ def get(self, resource_group_name: str, account_name: str, username: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -420,7 +414,7 @@ def get(self, resource_group_name: str, account_name: str, username: str, **kwar error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -521,7 +515,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2023_01_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -556,7 +550,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -571,7 +564,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -598,7 +591,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -621,7 +614,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -659,7 +651,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2023_01_01.models.LocalUserKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -682,7 +674,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -697,7 +688,7 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserKeys", pipeline_response) + deserialized = self._deserialize("LocalUserKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -724,7 +715,7 @@ def regenerate_password( :rtype: ~azure.mgmt.storage.v2023_01_01.models.LocalUserRegeneratePasswordResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -747,7 +738,6 @@ def regenerate_password( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -762,7 +752,7 @@ def regenerate_password( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response) + deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_management_policies_operations.py index 5eccc48f072f..54b62a627ef5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -202,7 +199,7 @@ def get( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -225,7 +222,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -239,7 +235,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -343,7 +339,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -378,7 +374,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -392,7 +387,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -424,7 +419,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -447,7 +442,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_object_replication_policies_operations.py index 6c8c4f746509..b14e81403910 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -237,7 +234,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -256,7 +253,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -272,7 +268,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -324,7 +319,7 @@ def get( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -347,7 +342,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -362,7 +356,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -472,7 +466,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -507,7 +501,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -522,7 +515,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -551,7 +544,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -574,7 +567,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_operations.py index 56dbe6bf4e1f..df181a9e7964 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -126,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_private_endpoint_connections_operations.py index ca36fdcccb86..4b520442628c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -249,7 +246,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -268,7 +265,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -284,7 +280,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -333,7 +328,7 @@ def get( :rtype: ~azure.mgmt.storage.v2023_01_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -356,7 +351,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -371,7 +365,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -472,7 +466,7 @@ def put( :rtype: ~azure.mgmt.storage.v2023_01_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -507,7 +501,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -522,7 +515,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -549,7 +542,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -572,7 +565,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_private_link_resources_operations.py index e0aba5583ba6..42a10efbff74 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -111,7 +108,7 @@ def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2023_01_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -133,7 +130,6 @@ def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -147,7 +143,7 @@ def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_queue_operations.py index 2720242f48e5..d0ed54dcf210 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -385,7 +382,7 @@ def create( :rtype: ~azure.mgmt.storage.v2023_01_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -420,7 +417,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -434,7 +430,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -541,7 +537,7 @@ def update( :rtype: ~azure.mgmt.storage.v2023_01_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -576,7 +572,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -590,7 +585,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -617,7 +612,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw :rtype: ~azure.mgmt.storage.v2023_01_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -640,7 +635,6 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -654,7 +648,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -683,7 +677,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -706,7 +700,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -757,7 +750,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -778,7 +771,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -794,7 +786,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_queue_services_operations.py index 323c25562021..1f1f9285af5a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2023_01_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +204,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -221,7 +217,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -316,7 +312,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2023_01_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -352,7 +348,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -366,7 +361,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -391,7 +386,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2023_01_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -415,7 +410,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -429,7 +423,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_skus_operations.py index 1c096f272047..fe2b50ffa308 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_storage_accounts_operations.py index 3a5b128f947b..9e0aa9c99c2d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -758,7 +758,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2023_01_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -790,7 +790,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -804,7 +803,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -817,8 +816,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -831,7 +830,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -852,10 +851,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -863,12 +862,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -991,10 +992,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1033,7 +1035,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1055,7 +1057,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1100,7 +1101,7 @@ def get_properties( :rtype: ~azure.mgmt.storage.v2023_01_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1123,7 +1124,6 @@ def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1137,7 +1137,7 @@ def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1248,7 +1248,7 @@ def update( :rtype: ~azure.mgmt.storage.v2023_01_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1282,7 +1282,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1296,7 +1295,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1318,7 +1317,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1335,7 +1334,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1351,7 +1349,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1398,7 +1395,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1416,7 +1413,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1432,7 +1428,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1482,7 +1477,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2023_01_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1505,7 +1500,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1519,7 +1513,7 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1613,7 +1607,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2023_01_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1647,7 +1641,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1661,7 +1654,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1752,7 +1745,7 @@ def list_account_sas( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1786,7 +1779,6 @@ def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1800,7 +1792,7 @@ def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1889,7 +1881,7 @@ def list_service_sas( :rtype: ~azure.mgmt.storage.v2023_01_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1923,7 +1915,6 @@ def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1937,17 +1928,17 @@ def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _failover_initial( # pylint: disable=inconsistent-return-statements + def _failover_initial( self, resource_group_name: str, account_name: str, failover_type: Literal["Planned"] = "Planned", **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1959,7 +1950,7 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1970,10 +1961,10 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1981,11 +1972,19 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_failover( @@ -2026,7 +2025,7 @@ def begin_failover( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._failover_initial( # type: ignore + raw_result = self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, failover_type=failover_type, @@ -2036,6 +2035,7 @@ def begin_failover( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2059,10 +2059,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, request_type: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2074,7 +2074,7 @@ def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-r _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -2085,10 +2085,10 @@ def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2096,12 +2096,20 @@ def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_hierarchical_namespace_migration( @@ -2134,7 +2142,7 @@ def begin_hierarchical_namespace_migration( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._hierarchical_namespace_migration_initial( # type: ignore + raw_result = self._hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, request_type=request_type, @@ -2144,6 +2152,7 @@ def begin_hierarchical_namespace_migration( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2167,10 +2176,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _abort_hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2182,7 +2191,7 @@ def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_abort_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -2192,10 +2201,10 @@ def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2203,12 +2212,20 @@ def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-long @@ -2236,7 +2253,7 @@ def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-lo lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._abort_hierarchical_namespace_migration_initial( # type: ignore + raw_result = self._abort_hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -2245,6 +2262,7 @@ def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-lo params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2268,14 +2286,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _customer_initiated_migration_initial( # pylint: disable=inconsistent-return-statements + def _customer_initiated_migration_initial( self, resource_group_name: str, account_name: str, parameters: Union[_models.StorageAccountMigration, IO[bytes]], **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2288,7 +2306,7 @@ def _customer_initiated_migration_initial( # pylint: disable=inconsistent-retur api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2309,10 +2327,10 @@ def _customer_initiated_migration_initial( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2320,6 +2338,10 @@ def _customer_initiated_migration_initial( # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -2328,8 +2350,12 @@ def _customer_initiated_migration_initial( # pylint: disable=inconsistent-retur if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload def begin_customer_initiated_migration( @@ -2437,7 +2463,7 @@ def begin_customer_initiated_migration( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._customer_initiated_migration_initial( # type: ignore + raw_result = self._customer_initiated_migration_initial( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, @@ -2448,6 +2474,7 @@ def begin_customer_initiated_migration( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2495,7 +2522,7 @@ def get_customer_initiated_migration( :rtype: ~azure.mgmt.storage.v2023_01_01.models.StorageAccountMigration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2518,7 +2545,6 @@ def get_customer_initiated_migration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2533,7 +2559,7 @@ def get_customer_initiated_migration( error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountMigration", pipeline_response) + deserialized = self._deserialize("StorageAccountMigration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2546,8 +2572,8 @@ def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2560,7 +2586,7 @@ def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2581,10 +2607,10 @@ def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2592,14 +2618,14 @@ def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2712,10 +2738,11 @@ def begin_restore_blob_ranges( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2756,7 +2783,7 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2778,7 +2805,6 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_table_operations.py index d369af3f9a90..00c9d7cc31ff 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -350,7 +347,7 @@ def create( :rtype: ~azure.mgmt.storage.v2023_01_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -388,7 +385,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -402,7 +398,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -506,7 +502,7 @@ def update( :rtype: ~azure.mgmt.storage.v2023_01_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -544,7 +540,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -558,7 +553,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -584,7 +579,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw :rtype: ~azure.mgmt.storage.v2023_01_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -607,7 +602,6 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -621,7 +615,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -649,7 +643,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -672,7 +666,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -710,7 +703,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -729,7 +722,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -745,7 +737,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_table_services_operations.py index add8f0feddf3..89ababee7376 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2023_01_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +204,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -221,7 +217,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -316,7 +312,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2023_01_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -352,7 +348,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -366,7 +361,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -391,7 +386,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2023_01_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -415,7 +410,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -429,7 +423,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_usages_operations.py index 10b5ea1d9165..dd592489da32 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_01_01/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -105,7 +102,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.Us api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -139,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/__init__.py index a860a5c185c9..60980065e1ee 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/_configuration.py index ef14ed56fef4..0764dabc5844 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/_metadata.json index fa4c951b32b2..a8ecdfe7db54 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/_metadata.json +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"StorageManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/_storage_management_client.py index cf6a3bc19465..fbf11af66426 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -45,11 +46,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar blob_services: BlobServicesOperations operations @@ -248,7 +248,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "StorageManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/_vendor.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/_version.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/_version.py index 5a163c0afedc..e5754a47ce68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/_version.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "21.2.1" \ No newline at end of file +VERSION = "1.0.0b1" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/__init__.py index a5c3d2414cfd..ee2b940bd4fc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._storage_management_client import StorageManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._storage_management_client import StorageManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "StorageManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/_configuration.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/_configuration.py index 59974e3ace8f..c72e14b6958f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/_configuration.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class StorageManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for StorageManagementClient. Note that all parameters used to create this instance are saved as instance diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/_storage_management_client.py index ef0e17dc2ca3..8403397691a6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/_storage_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -45,11 +46,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class StorageManagementClient: # pylint: disable=too-many-instance-attributes """The Azure Storage Management API. :ivar blob_services: BlobServicesOperations operations @@ -253,7 +253,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "StorageManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/__init__.py index e62e153ac4a1..18334b99b3ea 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/__init__.py @@ -5,34 +5,40 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._local_users_operations import LocalUsersOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations -from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations -from ._storage_task_assignments_operations import StorageTaskAssignmentsOperations -from ._storage_task_assignments_instances_report_operations import StorageTaskAssignmentsInstancesReportOperations -from ._storage_task_assignment_instances_report_operations import StorageTaskAssignmentInstancesReportOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._local_users_operations import LocalUsersOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore +from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore +from ._storage_task_assignments_operations import StorageTaskAssignmentsOperations # type: ignore +from ._storage_task_assignments_instances_report_operations import StorageTaskAssignmentsInstancesReportOperations # type: ignore +from ._storage_task_assignment_instances_report_operations import StorageTaskAssignmentInstancesReportOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -61,5 +67,5 @@ "StorageTaskAssignmentsInstancesReportOperations", "StorageTaskAssignmentInstancesReportOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_blob_containers_operations.py index b9f45e4db5e4..107ac64f3da2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_containers_operations import ( build_clear_legal_hold_request, build_create_or_update_immutability_policy_request, @@ -52,7 +65,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -117,7 +130,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -139,7 +152,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -155,7 +167,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -290,7 +301,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2023_05_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -325,7 +336,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -339,11 +349,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -453,7 +459,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2023_05_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -488,7 +494,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -502,7 +507,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -531,7 +536,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2023_05_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -554,7 +559,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -568,7 +572,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -576,9 +580,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any) -> None: """Deletes specified container under its account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -597,7 +599,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -620,7 +622,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -743,7 +744,7 @@ async def set_legal_hold( :rtype: ~azure.mgmt.storage.v2023_05_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -778,7 +779,6 @@ async def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -792,7 +792,7 @@ async def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -902,7 +902,7 @@ async def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2023_05_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -937,7 +937,6 @@ async def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -951,7 +950,7 @@ async def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -985,9 +984,9 @@ async def create_or_update_immutability_policy( letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required. :type container_name: str - :param if_match: The entity state (ETag) version of the immutability policy to update. A value - of "*" can be used to apply the operation only if the immutability policy already exists. If - omitted, this operation will always be applied. Default value is None. + :param if_match: The entity state (ETag) version of the immutability policy to update must be + returned to the server for all update operations. The ETag value must include the leading and + trailing double quotes as returned by the service. Default value is None. :type if_match: str :param parameters: The ImmutabilityPolicy Properties that will be created or updated to a blob container. Default value is None. @@ -1027,9 +1026,9 @@ async def create_or_update_immutability_policy( letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required. :type container_name: str - :param if_match: The entity state (ETag) version of the immutability policy to update. A value - of "*" can be used to apply the operation only if the immutability policy already exists. If - omitted, this operation will always be applied. Default value is None. + :param if_match: The entity state (ETag) version of the immutability policy to update must be + returned to the server for all update operations. The ETag value must include the leading and + trailing double quotes as returned by the service. Default value is None. :type if_match: str :param parameters: The ImmutabilityPolicy Properties that will be created or updated to a blob container. Default value is None. @@ -1067,9 +1066,9 @@ async def create_or_update_immutability_policy( letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required. :type container_name: str - :param if_match: The entity state (ETag) version of the immutability policy to update. A value - of "*" can be used to apply the operation only if the immutability policy already exists. If - omitted, this operation will always be applied. Default value is None. + :param if_match: The entity state (ETag) version of the immutability policy to update must be + returned to the server for all update operations. The ETag value must include the leading and + trailing double quotes as returned by the service. Default value is None. :type if_match: str :param parameters: The ImmutabilityPolicy Properties that will be created or updated to a blob container. Is either a ImmutabilityPolicy type or a IO[bytes] type. Default value is None. @@ -1078,7 +1077,7 @@ async def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2023_05_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1119,7 +1118,6 @@ async def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1136,7 +1134,7 @@ async def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1167,15 +1165,15 @@ async def get_immutability_policy( letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required. :type container_name: str - :param if_match: The entity state (ETag) version of the immutability policy to update. A value - of "*" can be used to apply the operation only if the immutability policy already exists. If - omitted, this operation will always be applied. Default value is None. + :param if_match: The entity state (ETag) version of the immutability policy to update must be + returned to the server for all update operations. The ETag value must include the leading and + trailing double quotes as returned by the service. Default value is None. :type if_match: str :return: ImmutabilityPolicy or the result of cls(response) :rtype: ~azure.mgmt.storage.v2023_05_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1201,7 +1199,6 @@ async def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1218,7 +1215,7 @@ async def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1246,15 +1243,15 @@ async def delete_immutability_policy( letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required. :type container_name: str - :param if_match: The entity state (ETag) version of the immutability policy to update. A value - of "*" can be used to apply the operation only if the immutability policy already exists. If - omitted, this operation will always be applied. Required. + :param if_match: The entity state (ETag) version of the immutability policy to update must be + returned to the server for all update operations. The ETag value must include the leading and + trailing double quotes as returned by the service. Required. :type if_match: str :return: ImmutabilityPolicy or the result of cls(response) :rtype: ~azure.mgmt.storage.v2023_05_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1280,7 +1277,6 @@ async def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1297,7 +1293,7 @@ async def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1323,15 +1319,15 @@ async def lock_immutability_policy( letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required. :type container_name: str - :param if_match: The entity state (ETag) version of the immutability policy to update. A value - of "*" can be used to apply the operation only if the immutability policy already exists. If - omitted, this operation will always be applied. Required. + :param if_match: The entity state (ETag) version of the immutability policy to update must be + returned to the server for all update operations. The ETag value must include the leading and + trailing double quotes as returned by the service. Required. :type if_match: str :return: ImmutabilityPolicy or the result of cls(response) :rtype: ~azure.mgmt.storage.v2023_05_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1355,7 +1351,6 @@ async def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1372,7 +1367,7 @@ async def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1407,9 +1402,9 @@ async def extend_immutability_policy( letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required. :type container_name: str - :param if_match: The entity state (ETag) version of the immutability policy to update. A value - of "*" can be used to apply the operation only if the immutability policy already exists. If - omitted, this operation will always be applied. Required. + :param if_match: The entity state (ETag) version of the immutability policy to update must be + returned to the server for all update operations. The ETag value must include the leading and + trailing double quotes as returned by the service. Required. :type if_match: str :param parameters: The ImmutabilityPolicy Properties that will be extended for a blob container. Default value is None. @@ -1450,9 +1445,9 @@ async def extend_immutability_policy( letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required. :type container_name: str - :param if_match: The entity state (ETag) version of the immutability policy to update. A value - of "*" can be used to apply the operation only if the immutability policy already exists. If - omitted, this operation will always be applied. Required. + :param if_match: The entity state (ETag) version of the immutability policy to update must be + returned to the server for all update operations. The ETag value must include the leading and + trailing double quotes as returned by the service. Required. :type if_match: str :param parameters: The ImmutabilityPolicy Properties that will be extended for a blob container. Default value is None. @@ -1491,9 +1486,9 @@ async def extend_immutability_policy( letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required. :type container_name: str - :param if_match: The entity state (ETag) version of the immutability policy to update. A value - of "*" can be used to apply the operation only if the immutability policy already exists. If - omitted, this operation will always be applied. Required. + :param if_match: The entity state (ETag) version of the immutability policy to update must be + returned to the server for all update operations. The ETag value must include the leading and + trailing double quotes as returned by the service. Required. :type if_match: str :param parameters: The ImmutabilityPolicy Properties that will be extended for a blob container. Is either a ImmutabilityPolicy type or a IO[bytes] type. Default value is None. @@ -1502,7 +1497,7 @@ async def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2023_05_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1541,7 +1536,6 @@ async def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1558,7 +1552,7 @@ async def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1668,7 +1662,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2023_05_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1706,7 +1700,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1720,17 +1713,17 @@ async def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _object_level_worm_initial( # pylint: disable=inconsistent-return-statements + async def _object_level_worm_initial( self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1742,7 +1735,7 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_object_level_worm_request( resource_group_name=resource_group_name, @@ -1753,10 +1746,10 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1764,11 +1757,19 @@ async def _object_level_worm_initial( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_object_level_worm( @@ -1804,7 +1805,7 @@ async def begin_object_level_worm( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._object_level_worm_initial( # type: ignore + raw_result = await self._object_level_worm_initial( resource_group_name=resource_group_name, account_name=account_name, container_name=container_name, @@ -1814,6 +1815,7 @@ async def begin_object_level_worm( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_blob_inventory_policies_operations.py index 0fa7a978bdb8..16c02ffba5a3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_inventory_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2023_05_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,7 +110,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -127,7 +123,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -231,7 +227,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2023_05_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -266,7 +262,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -280,7 +275,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -288,7 +283,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -312,7 +307,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -335,7 +330,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -376,7 +370,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -395,7 +389,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -411,7 +404,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_blob_services_operations.py index 11bfbe35b07f..66c38946e41b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._blob_services_operations import ( build_get_service_properties_request, build_list_request, @@ -39,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +86,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +120,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -241,7 +236,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2023_05_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -277,7 +272,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -291,7 +285,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -316,7 +310,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2023_05_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -340,7 +334,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,7 +347,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_deleted_accounts_operations.py index 9a75d7529c31..c389b47e2663 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,21 +19,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._deleted_accounts_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DeletedAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +88,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -107,7 +103,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -149,7 +144,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> :rtype: ~azure.mgmt.storage.v2023_05_01.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +166,6 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -186,7 +180,7 @@ async def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_encryption_scopes_operations.py index 19118fc7b53a..fc5d1d347bc1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._encryption_scopes_operations import ( build_get_request, build_list_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -173,7 +170,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2023_05_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +205,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -223,11 +219,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,7 +329,7 @@ async def patch( :rtype: ~azure.mgmt.storage.v2023_05_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +364,6 @@ async def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -387,7 +378,7 @@ async def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -416,7 +407,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2023_05_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -439,7 +430,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -454,7 +444,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -500,7 +490,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -522,7 +512,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -538,7 +527,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_file_services_operations.py index b7eff2d9771a..beec036e05e6 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2023_05_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -207,7 +203,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2023_05_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +239,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -257,7 +252,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -282,7 +277,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2023_05_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +301,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -320,7 +314,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_file_shares_operations.py index 263ba0a63da7..d8c7b581baf8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_file_shares_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_shares_operations import ( build_create_request, build_delete_request, @@ -43,7 +40,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -108,7 +105,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -130,7 +127,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -146,7 +142,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -293,7 +288,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2023_05_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -329,7 +324,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -343,11 +337,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -457,7 +447,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2023_05_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -492,7 +482,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -506,7 +495,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -547,7 +536,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2023_05_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -572,7 +561,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -586,7 +574,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -594,7 +582,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -631,7 +619,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -656,7 +644,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -674,7 +661,7 @@ async def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -709,7 +696,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @overload - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -744,7 +731,7 @@ async def restore( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def restore( # pylint: disable=inconsistent-return-statements + async def restore( self, resource_group_name: str, account_name: str, @@ -772,7 +759,7 @@ async def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -807,7 +794,6 @@ async def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -939,7 +925,7 @@ async def lease( :rtype: ~azure.mgmt.storage.v2023_05_01.models.LeaseShareResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -978,7 +964,6 @@ async def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -995,7 +980,7 @@ async def lease( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("LeaseShareResponse", pipeline_response) + deserialized = self._deserialize("LeaseShareResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_local_users_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_local_users_operations.py index d57fb96e944a..73e1885ff695 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_local_users_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_local_users_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._local_users_operations import ( build_create_or_update_request, build_delete_request, @@ -42,7 +39,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -106,7 +103,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.LocalUsers] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -128,7 +125,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -144,7 +140,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -192,7 +187,7 @@ async def get(self, resource_group_name: str, account_name: str, username: str, :rtype: ~azure.mgmt.storage.v2023_05_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -215,7 +210,6 @@ async def get(self, resource_group_name: str, account_name: str, username: str, headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -230,7 +224,7 @@ async def get(self, resource_group_name: str, account_name: str, username: str, error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -334,7 +328,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2023_05_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -369,7 +363,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -384,7 +377,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -392,9 +385,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, username: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, username: str, **kwargs: Any) -> None: """Deletes the local user associated with the specified storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -411,7 +402,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -434,7 +425,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -472,7 +462,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2023_05_01.models.LocalUserKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -495,7 +485,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -510,7 +499,7 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserKeys", pipeline_response) + deserialized = self._deserialize("LocalUserKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -537,7 +526,7 @@ async def regenerate_password( :rtype: ~azure.mgmt.storage.v2023_05_01.models.LocalUserRegeneratePasswordResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -560,7 +549,6 @@ async def regenerate_password( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -575,7 +563,7 @@ async def regenerate_password( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response) + deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_management_policies_operations.py index 734fec88534a..10f82ca8c8a8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._management_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +83,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2023_05_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +119,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -227,7 +223,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2023_05_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -262,7 +258,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -276,7 +271,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -284,7 +279,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, @@ -308,7 +303,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +326,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_network_security_perimeter_configurations_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_network_security_perimeter_configurations_operations.py index a27e3ba1f437..88e591f6abaa 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_network_security_perimeter_configurations_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_network_security_perimeter_configurations_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar, Union, cast +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, TypeVar, Union, cast import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +16,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -30,7 +30,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._network_security_perimeter_configurations_operations import ( build_get_request, build_list_request, @@ -40,7 +39,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,6 +68,7 @@ def __init__(self, *args, **kwargs) -> None: def list( self, resource_group_name: str, account_name: str, **kwargs: Any ) -> AsyncIterable["_models.NetworkSecurityPerimeterConfiguration"]: + # pylint: disable=line-too-long """Gets list of effective NetworkSecurityPerimeterConfiguration for storage account. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -90,7 +90,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.NetworkSecurityPerimeterConfigurationList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +109,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +124,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -179,7 +177,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2023_05_01.models.NetworkSecurityPerimeterConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -202,7 +200,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -217,21 +214,21 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response) + deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _reconcile_initial( # pylint: disable=inconsistent-return-statements + async def _reconcile_initial( self, resource_group_name: str, account_name: str, network_security_perimeter_configuration_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +240,7 @@ async def _reconcile_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_reconcile_request( resource_group_name=resource_group_name, @@ -254,10 +251,10 @@ async def _reconcile_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -265,6 +262,10 @@ async def _reconcile_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -272,8 +273,12 @@ async def _reconcile_initial( # pylint: disable=inconsistent-return-statements response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_reconcile( @@ -308,7 +313,7 @@ async def begin_reconcile( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._reconcile_initial( # type: ignore + raw_result = await self._reconcile_initial( resource_group_name=resource_group_name, account_name=account_name, network_security_perimeter_configuration_name=network_security_perimeter_configuration_name, @@ -318,6 +323,7 @@ async def begin_reconcile( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_object_replication_policies_operations.py index 73f95a92ffc6..6bfcebc13883 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._object_replication_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -177,7 +172,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2023_05_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -200,7 +195,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +209,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -325,7 +319,7 @@ async def create_or_update( :rtype: ~azure.mgmt.storage.v2023_05_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -360,7 +354,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -375,7 +368,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -383,7 +376,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, object_replication_policy_id: str, **kwargs: Any ) -> None: """Deletes the object replication policy associated with the specified storage account. @@ -404,7 +397,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +420,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_operations.py index 7aa1c1baa1b0..400da45c98ca 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +101,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_private_endpoint_connections_operations.py index 6a5828fa9867..81086b4016f2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connections_operations import ( build_delete_request, build_get_request, @@ -40,7 +37,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -174,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2023_05_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -197,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -212,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -313,7 +307,7 @@ async def put( :rtype: ~azure.mgmt.storage.v2023_05_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +342,6 @@ async def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -363,7 +356,7 @@ async def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -371,7 +364,7 @@ async def put( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: """Deletes the specified private endpoint connection associated with the storage account. @@ -390,7 +383,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -413,7 +406,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_private_link_resources_operations.py index e8dfc6f0cb42..71e2d534c4ff 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_by_storage_account_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ async def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2023_05_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,7 +92,6 @@ async def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +105,7 @@ async def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_queue_operations.py index 983152d2a530..895458d188fa 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_operations import ( build_create_request, build_delete_request, @@ -41,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -166,7 +163,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2023_05_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -322,7 +318,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2023_05_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -357,7 +353,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -371,7 +366,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -400,7 +395,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2023_05_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +418,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -437,7 +431,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -445,9 +439,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, queue_name: str, **kwargs: Any) -> None: """Deletes the queue with the specified queue name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -466,7 +458,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -489,7 +481,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -541,7 +532,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -562,7 +553,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -578,7 +568,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_queue_services_operations.py index 8e6414cf7729..c86b8564fbc1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._queue_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2023_05_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -207,7 +203,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2023_05_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +239,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -257,7 +252,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -282,7 +277,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2023_05_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +301,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -320,7 +314,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_skus_operations.py index 8c33030e8b6b..807446895b47 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._skus_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -90,7 +87,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -106,7 +102,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_storage_accounts_operations.py index 4894f9f5100a..a1c0bd1bcdc9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +31,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +45,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_accounts_operations import ( build_abort_hierarchical_namespace_migration_request, build_check_name_availability_request, @@ -56,7 +69,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -139,7 +152,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.storage.v2023_05_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +184,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -185,7 +197,7 @@ async def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -198,8 +210,8 @@ async def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -212,7 +224,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -233,10 +245,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -244,12 +256,14 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -375,10 +389,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -401,9 +416,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Deletes a storage account in Microsoft Azure. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -417,7 +430,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -439,7 +452,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -484,7 +496,7 @@ async def get_properties( :rtype: ~azure.mgmt.storage.v2023_05_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -507,7 +519,6 @@ async def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -521,7 +532,7 @@ async def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -632,7 +643,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2023_05_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -666,7 +677,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -680,7 +690,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -703,7 +713,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -720,7 +730,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -736,7 +745,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -786,7 +794,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -804,7 +812,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -820,7 +827,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -870,7 +876,7 @@ async def list_keys( :rtype: ~azure.mgmt.storage.v2023_05_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -893,7 +899,6 @@ async def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -907,7 +912,7 @@ async def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1001,7 +1006,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.storage.v2023_05_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1035,7 +1040,6 @@ async def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1049,7 +1053,7 @@ async def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1140,7 +1144,7 @@ async def list_account_sas( :rtype: ~azure.mgmt.storage.v2023_05_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1174,7 +1178,6 @@ async def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1188,7 +1191,7 @@ async def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1277,7 +1280,7 @@ async def list_service_sas( :rtype: ~azure.mgmt.storage.v2023_05_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1311,7 +1314,6 @@ async def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1325,17 +1327,17 @@ async def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _failover_initial( # pylint: disable=inconsistent-return-statements + async def _failover_initial( self, resource_group_name: str, account_name: str, failover_type: Literal["Planned"] = "Planned", **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1347,7 +1349,7 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1358,10 +1360,10 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1369,11 +1371,19 @@ async def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_failover( @@ -1414,7 +1424,7 @@ async def begin_failover( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._failover_initial( # type: ignore + raw_result = await self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, failover_type=failover_type, @@ -1424,6 +1434,7 @@ async def begin_failover( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1447,10 +1458,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, request_type: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1462,7 +1473,7 @@ async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -1473,10 +1484,10 @@ async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1484,12 +1495,20 @@ async def _hierarchical_namespace_migration_initial( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_hierarchical_namespace_migration( @@ -1522,7 +1541,7 @@ async def begin_hierarchical_namespace_migration( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._hierarchical_namespace_migration_initial( # type: ignore + raw_result = await self._hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, request_type=request_type, @@ -1532,6 +1551,7 @@ async def begin_hierarchical_namespace_migration( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1555,10 +1575,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1570,7 +1590,7 @@ async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=in _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_abort_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -1580,10 +1600,10 @@ async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=in headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1591,12 +1611,20 @@ async def _abort_hierarchical_namespace_migration_initial( # pylint: disable=in response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-long @@ -1624,7 +1652,7 @@ async def begin_abort_hierarchical_namespace_migration( # pylint: disable=name- lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._abort_hierarchical_namespace_migration_initial( # type: ignore + raw_result = await self._abort_hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -1633,6 +1661,7 @@ async def begin_abort_hierarchical_namespace_migration( # pylint: disable=name- params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1656,14 +1685,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _customer_initiated_migration_initial( # pylint: disable=inconsistent-return-statements + async def _customer_initiated_migration_initial( self, resource_group_name: str, account_name: str, parameters: Union[_models.StorageAccountMigration, IO[bytes]], **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1676,7 +1705,7 @@ async def _customer_initiated_migration_initial( # pylint: disable=inconsistent api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1697,10 +1726,10 @@ async def _customer_initiated_migration_initial( # pylint: disable=inconsistent headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1708,6 +1737,10 @@ async def _customer_initiated_migration_initial( # pylint: disable=inconsistent response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1716,8 +1749,12 @@ async def _customer_initiated_migration_initial( # pylint: disable=inconsistent if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload async def begin_customer_initiated_migration( @@ -1825,7 +1862,7 @@ async def begin_customer_initiated_migration( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._customer_initiated_migration_initial( # type: ignore + raw_result = await self._customer_initiated_migration_initial( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, @@ -1836,6 +1873,7 @@ async def begin_customer_initiated_migration( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -1883,7 +1921,7 @@ async def get_customer_initiated_migration( :rtype: ~azure.mgmt.storage.v2023_05_01.models.StorageAccountMigration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1906,7 +1944,6 @@ async def get_customer_initiated_migration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1921,7 +1958,7 @@ async def get_customer_initiated_migration( error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountMigration", pipeline_response) + deserialized = self._deserialize("StorageAccountMigration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1934,8 +1971,8 @@ async def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1948,7 +1985,7 @@ async def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1969,10 +2006,10 @@ async def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1980,14 +2017,14 @@ async def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2103,10 +2140,11 @@ async def begin_restore_blob_ranges( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2131,9 +2169,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: + async def revoke_user_delegation_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) -> None: """Revoke user delegation keys. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -2147,7 +2183,7 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2169,7 +2205,6 @@ async def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_storage_task_assignment_instances_report_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_storage_task_assignment_instances_report_operations.py index 8a52e7d314cc..8338be3708fd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_storage_task_assignment_instances_report_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_storage_task_assignment_instances_report_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_task_assignment_instances_report_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,6 +65,7 @@ def list( filter: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.StorageTaskReportInstance"]: + # pylint: disable=line-too-long """Fetch the report summary of a single storage task assignment's instances. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -101,7 +99,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.StorageTaskReportSummary] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,7 +121,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -139,7 +136,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_storage_task_assignments_instances_report_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_storage_task_assignments_instances_report_operations.py index 14344be4fdd5..b2e92ba6d702 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_storage_task_assignments_instances_report_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_storage_task_assignments_instances_report_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_task_assignments_instances_report_operations import build_list_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,6 +64,7 @@ def list( filter: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.StorageTaskReportInstance"]: + # pylint: disable=line-too-long """Fetch the report summary of all the storage task assignments and instances in an account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -96,7 +94,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.StorageTaskReportSummary] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -117,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -133,7 +130,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_storage_task_assignments_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_storage_task_assignments_operations.py index 68e89fd42d72..6d5c7bf6dd71 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_storage_task_assignments_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_storage_task_assignments_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -31,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._storage_task_assignments_operations import ( build_create_request, build_delete_request, @@ -43,7 +42,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,8 +74,8 @@ async def _create_initial( storage_task_assignment_name: str, parameters: Union[_models.StorageTaskAssignment, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageTaskAssignment]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +88,7 @@ async def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageTaskAssignment]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -111,10 +110,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -122,21 +121,20 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("StorageTaskAssignment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("StorageTaskAssignment", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -279,10 +277,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageTaskAssignment", pipeline_response) + deserialized = self._deserialize("StorageTaskAssignment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -313,8 +312,8 @@ async def _update_initial( storage_task_assignment_name: str, parameters: Union[_models.StorageTaskAssignmentUpdateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageTaskAssignment]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -327,7 +326,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageTaskAssignment]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -349,10 +348,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -360,18 +359,20 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("StorageTaskAssignment", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -503,10 +504,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageTaskAssignment", pipeline_response) + deserialized = self._deserialize("StorageTaskAssignment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -551,7 +553,7 @@ async def get( :rtype: ~azure.mgmt.storage.v2023_05_01.models.StorageTaskAssignment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -574,7 +576,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -589,17 +590,17 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageTaskAssignment", pipeline_response) + deserialized = self._deserialize("StorageTaskAssignment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, account_name: str, storage_task_assignment_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -611,7 +612,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -622,10 +623,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -633,6 +634,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -641,8 +646,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -674,7 +683,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, storage_task_assignment_name=storage_task_assignment_name, @@ -684,6 +693,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -735,7 +745,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.StorageTaskAssignmentsList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -755,7 +765,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -771,7 +780,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_table_operations.py index 5a7587e7a961..0cbc2da1955f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_operations import ( build_create_request, build_delete_request, @@ -41,7 +38,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -163,7 +160,7 @@ async def create( :rtype: ~azure.mgmt.storage.v2023_05_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +198,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +211,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -319,7 +315,7 @@ async def update( :rtype: ~azure.mgmt.storage.v2023_05_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -357,7 +353,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -371,7 +366,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -397,7 +392,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str :rtype: ~azure.mgmt.storage.v2023_05_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -420,7 +415,6 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -434,7 +428,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -442,9 +436,7 @@ async def get(self, resource_group_name: str, account_name: str, table_name: str return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> None: + async def delete(self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any) -> None: """Deletes the table with the specified table name, under the specified account if it exists. :param resource_group_name: The name of the resource group within the user's subscription. The @@ -462,7 +454,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -485,7 +477,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -523,7 +514,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -542,7 +533,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -558,7 +548,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_table_services_operations.py index 3f74a2488877..5b5a4673c2ed 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._table_services_operations import ( build_get_service_properties_request, build_list_request, @@ -36,7 +33,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +73,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.storage.v2023_05_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +95,6 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -112,7 +108,7 @@ async def list(self, resource_group_name: str, account_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -207,7 +203,7 @@ async def set_service_properties( :rtype: ~azure.mgmt.storage.v2023_05_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +239,6 @@ async def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -257,7 +252,7 @@ async def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -282,7 +277,7 @@ async def get_service_properties( :rtype: ~azure.mgmt.storage.v2023_05_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +301,6 @@ async def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -320,7 +314,7 @@ async def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_usages_operations.py index 2cfe1b9f0a65..6ca63d8f0c8f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/aio/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,20 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._usages_operations import build_list_by_location_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +72,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> AsyncIterable["_mode api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -109,7 +105,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/models/__init__.py index 32d458c161b4..46195c06af2b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/models/__init__.py @@ -5,270 +5,281 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccessPolicy -from ._models_py3 import AccountImmutabilityPolicyProperties -from ._models_py3 import AccountSasParameters -from ._models_py3 import ActiveDirectoryProperties -from ._models_py3 import AzureEntityResource -from ._models_py3 import AzureFilesIdentityBasedAuthentication -from ._models_py3 import BlobContainer -from ._models_py3 import BlobInventoryCreationTime -from ._models_py3 import BlobInventoryPolicy -from ._models_py3 import BlobInventoryPolicyDefinition -from ._models_py3 import BlobInventoryPolicyFilter -from ._models_py3 import BlobInventoryPolicyRule -from ._models_py3 import BlobInventoryPolicySchema -from ._models_py3 import BlobRestoreParameters -from ._models_py3 import BlobRestoreRange -from ._models_py3 import BlobRestoreStatus -from ._models_py3 import BlobServiceItems -from ._models_py3 import BlobServiceProperties -from ._models_py3 import ChangeFeed -from ._models_py3 import CheckNameAvailabilityResult -from ._models_py3 import CloudErrorBody -from ._models_py3 import CorsRule -from ._models_py3 import CorsRules -from ._models_py3 import CustomDomain -from ._models_py3 import DateAfterCreation -from ._models_py3 import DateAfterModification -from ._models_py3 import DeleteRetentionPolicy -from ._models_py3 import DeletedAccount -from ._models_py3 import DeletedAccountListResult -from ._models_py3 import DeletedShare -from ._models_py3 import Dimension -from ._models_py3 import Encryption -from ._models_py3 import EncryptionIdentity -from ._models_py3 import EncryptionScope -from ._models_py3 import EncryptionScopeKeyVaultProperties -from ._models_py3 import EncryptionScopeListResult -from ._models_py3 import EncryptionService -from ._models_py3 import EncryptionServices -from ._models_py3 import Endpoints -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import ErrorResponseAutoGenerated -from ._models_py3 import ErrorResponseBody -from ._models_py3 import ExecutionTarget -from ._models_py3 import ExecutionTrigger -from ._models_py3 import ExecutionTriggerUpdate -from ._models_py3 import ExtendedLocation -from ._models_py3 import FileServiceItems -from ._models_py3 import FileServiceProperties -from ._models_py3 import FileShare -from ._models_py3 import FileShareItem -from ._models_py3 import FileShareItems -from ._models_py3 import GeoReplicationStats -from ._models_py3 import IPRule -from ._models_py3 import Identity -from ._models_py3 import ImmutabilityPolicy -from ._models_py3 import ImmutabilityPolicyProperties -from ._models_py3 import ImmutableStorageAccount -from ._models_py3 import ImmutableStorageWithVersioning -from ._models_py3 import KeyCreationTime -from ._models_py3 import KeyPolicy -from ._models_py3 import KeyVaultProperties -from ._models_py3 import LastAccessTimeTrackingPolicy -from ._models_py3 import LeaseContainerRequest -from ._models_py3 import LeaseContainerResponse -from ._models_py3 import LeaseShareRequest -from ._models_py3 import LeaseShareResponse -from ._models_py3 import LegalHold -from ._models_py3 import LegalHoldProperties -from ._models_py3 import ListAccountSasResponse -from ._models_py3 import ListBlobInventoryPolicy -from ._models_py3 import ListContainerItem -from ._models_py3 import ListContainerItems -from ._models_py3 import ListQueue -from ._models_py3 import ListQueueResource -from ._models_py3 import ListQueueServices -from ._models_py3 import ListServiceSasResponse -from ._models_py3 import ListTableResource -from ._models_py3 import ListTableServices -from ._models_py3 import LocalUser -from ._models_py3 import LocalUserKeys -from ._models_py3 import LocalUserRegeneratePasswordResult -from ._models_py3 import LocalUsers -from ._models_py3 import ManagementPolicy -from ._models_py3 import ManagementPolicyAction -from ._models_py3 import ManagementPolicyBaseBlob -from ._models_py3 import ManagementPolicyDefinition -from ._models_py3 import ManagementPolicyFilter -from ._models_py3 import ManagementPolicyRule -from ._models_py3 import ManagementPolicySchema -from ._models_py3 import ManagementPolicySnapShot -from ._models_py3 import ManagementPolicyVersion -from ._models_py3 import MetricSpecification -from ._models_py3 import Multichannel -from ._models_py3 import NetworkRuleSet -from ._models_py3 import NetworkSecurityPerimeter -from ._models_py3 import NetworkSecurityPerimeterConfiguration -from ._models_py3 import NetworkSecurityPerimeterConfigurationList -from ._models_py3 import NetworkSecurityPerimeterConfigurationPropertiesProfile -from ._models_py3 import NetworkSecurityPerimeterConfigurationPropertiesResourceAssociation -from ._models_py3 import NspAccessRule -from ._models_py3 import NspAccessRuleProperties -from ._models_py3 import NspAccessRulePropertiesSubscriptionsItem -from ._models_py3 import ObjectReplicationPolicies -from ._models_py3 import ObjectReplicationPolicy -from ._models_py3 import ObjectReplicationPolicyFilter -from ._models_py3 import ObjectReplicationPolicyRule -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import PermissionScope -from ._models_py3 import PrivateEndpoint -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionListResult -from ._models_py3 import PrivateLinkResource -from ._models_py3 import PrivateLinkResourceListResult -from ._models_py3 import PrivateLinkServiceConnectionState -from ._models_py3 import ProtectedAppendWritesHistory -from ._models_py3 import ProtocolSettings -from ._models_py3 import ProvisioningIssue -from ._models_py3 import ProvisioningIssueProperties -from ._models_py3 import ProxyResource -from ._models_py3 import ProxyResourceAutoGenerated -from ._models_py3 import QueueServiceProperties -from ._models_py3 import Resource -from ._models_py3 import ResourceAccessRule -from ._models_py3 import ResourceAutoGenerated -from ._models_py3 import RestorePolicyProperties -from ._models_py3 import Restriction -from ._models_py3 import RoutingPreference -from ._models_py3 import SKUCapability -from ._models_py3 import SasPolicy -from ._models_py3 import ServiceSasParameters -from ._models_py3 import ServiceSpecification -from ._models_py3 import SignedIdentifier -from ._models_py3 import Sku -from ._models_py3 import SkuInformation -from ._models_py3 import SmbSetting -from ._models_py3 import SshPublicKey -from ._models_py3 import StorageAccount -from ._models_py3 import StorageAccountCheckNameAvailabilityParameters -from ._models_py3 import StorageAccountCreateParameters -from ._models_py3 import StorageAccountInternetEndpoints -from ._models_py3 import StorageAccountKey -from ._models_py3 import StorageAccountListKeysResult -from ._models_py3 import StorageAccountListResult -from ._models_py3 import StorageAccountMicrosoftEndpoints -from ._models_py3 import StorageAccountMigration -from ._models_py3 import StorageAccountRegenerateKeyParameters -from ._models_py3 import StorageAccountSkuConversionStatus -from ._models_py3 import StorageAccountUpdateParameters -from ._models_py3 import StorageQueue -from ._models_py3 import StorageSkuListResult -from ._models_py3 import StorageTaskAssignment -from ._models_py3 import StorageTaskAssignmentExecutionContext -from ._models_py3 import StorageTaskAssignmentProperties -from ._models_py3 import StorageTaskAssignmentReport -from ._models_py3 import StorageTaskAssignmentUpdateExecutionContext -from ._models_py3 import StorageTaskAssignmentUpdateParameters -from ._models_py3 import StorageTaskAssignmentUpdateProperties -from ._models_py3 import StorageTaskAssignmentUpdateReport -from ._models_py3 import StorageTaskAssignmentsList -from ._models_py3 import StorageTaskReportInstance -from ._models_py3 import StorageTaskReportProperties -from ._models_py3 import StorageTaskReportSummary -from ._models_py3 import SystemData -from ._models_py3 import Table -from ._models_py3 import TableAccessPolicy -from ._models_py3 import TableServiceProperties -from ._models_py3 import TableSignedIdentifier -from ._models_py3 import TagFilter -from ._models_py3 import TagProperty -from ._models_py3 import TrackedResource -from ._models_py3 import TriggerParameters -from ._models_py3 import TriggerParametersUpdate -from ._models_py3 import UpdateHistoryProperty -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UsageName -from ._models_py3 import UserAssignedIdentity -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._storage_management_client_enums import AccessTier -from ._storage_management_client_enums import AccountImmutabilityPolicyState -from ._storage_management_client_enums import AccountStatus -from ._storage_management_client_enums import AccountType -from ._storage_management_client_enums import AllowedCopyScope -from ._storage_management_client_enums import AllowedMethods -from ._storage_management_client_enums import BlobInventoryPolicyName -from ._storage_management_client_enums import BlobRestoreProgressStatus -from ._storage_management_client_enums import Bypass -from ._storage_management_client_enums import CreatedByType -from ._storage_management_client_enums import DefaultAction -from ._storage_management_client_enums import DefaultSharePermission -from ._storage_management_client_enums import DirectoryServiceOptions -from ._storage_management_client_enums import DnsEndpointType -from ._storage_management_client_enums import EnabledProtocols -from ._storage_management_client_enums import EncryptionScopeSource -from ._storage_management_client_enums import EncryptionScopeState -from ._storage_management_client_enums import ExpirationAction -from ._storage_management_client_enums import ExtendedLocationTypes -from ._storage_management_client_enums import Format -from ._storage_management_client_enums import GeoReplicationStatus -from ._storage_management_client_enums import HttpProtocol -from ._storage_management_client_enums import IdentityType -from ._storage_management_client_enums import ImmutabilityPolicyState -from ._storage_management_client_enums import ImmutabilityPolicyUpdateType -from ._storage_management_client_enums import InventoryRuleType -from ._storage_management_client_enums import IssueType -from ._storage_management_client_enums import KeyPermission -from ._storage_management_client_enums import KeySource -from ._storage_management_client_enums import KeyType -from ._storage_management_client_enums import Kind -from ._storage_management_client_enums import LargeFileSharesState -from ._storage_management_client_enums import LeaseContainerRequestEnum -from ._storage_management_client_enums import LeaseDuration -from ._storage_management_client_enums import LeaseShareAction -from ._storage_management_client_enums import LeaseState -from ._storage_management_client_enums import LeaseStatus -from ._storage_management_client_enums import ListContainersInclude -from ._storage_management_client_enums import ListEncryptionScopesInclude -from ._storage_management_client_enums import ListLocalUserIncludeParam -from ._storage_management_client_enums import ManagementPolicyName -from ._storage_management_client_enums import MigrationName -from ._storage_management_client_enums import MigrationState -from ._storage_management_client_enums import MigrationStatus -from ._storage_management_client_enums import MinimumTlsVersion -from ._storage_management_client_enums import Name -from ._storage_management_client_enums import NetworkSecurityPerimeterConfigurationProvisioningState -from ._storage_management_client_enums import NspAccessRuleDirection -from ._storage_management_client_enums import ObjectType -from ._storage_management_client_enums import Permissions -from ._storage_management_client_enums import PostFailoverRedundancy -from ._storage_management_client_enums import PostPlannedFailoverRedundancy -from ._storage_management_client_enums import PrivateEndpointConnectionProvisioningState -from ._storage_management_client_enums import PrivateEndpointServiceConnectionStatus -from ._storage_management_client_enums import ProvisioningState -from ._storage_management_client_enums import PublicAccess -from ._storage_management_client_enums import PublicNetworkAccess -from ._storage_management_client_enums import Reason -from ._storage_management_client_enums import ReasonCode -from ._storage_management_client_enums import ResourceAssociationAccessMode -from ._storage_management_client_enums import RootSquashType -from ._storage_management_client_enums import RoutingChoice -from ._storage_management_client_enums import RuleType -from ._storage_management_client_enums import RunResult -from ._storage_management_client_enums import RunStatusEnum -from ._storage_management_client_enums import Schedule -from ._storage_management_client_enums import Services -from ._storage_management_client_enums import Severity -from ._storage_management_client_enums import ShareAccessTier -from ._storage_management_client_enums import SignedResource -from ._storage_management_client_enums import SignedResourceTypes -from ._storage_management_client_enums import SkuConversionStatus -from ._storage_management_client_enums import SkuName -from ._storage_management_client_enums import SkuTier -from ._storage_management_client_enums import State -from ._storage_management_client_enums import StorageAccountExpand -from ._storage_management_client_enums import TriggerType -from ._storage_management_client_enums import UsageUnit +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccessPolicy, + AccountImmutabilityPolicyProperties, + AccountSasParameters, + ActiveDirectoryProperties, + AzureEntityResource, + AzureFilesIdentityBasedAuthentication, + BlobContainer, + BlobInventoryCreationTime, + BlobInventoryPolicy, + BlobInventoryPolicyDefinition, + BlobInventoryPolicyFilter, + BlobInventoryPolicyRule, + BlobInventoryPolicySchema, + BlobRestoreParameters, + BlobRestoreRange, + BlobRestoreStatus, + BlobServiceItems, + BlobServiceProperties, + ChangeFeed, + CheckNameAvailabilityResult, + CloudErrorBody, + CorsRule, + CorsRules, + CustomDomain, + DateAfterCreation, + DateAfterModification, + DeleteRetentionPolicy, + DeletedAccount, + DeletedAccountListResult, + DeletedShare, + Dimension, + Encryption, + EncryptionIdentity, + EncryptionScope, + EncryptionScopeKeyVaultProperties, + EncryptionScopeListResult, + EncryptionService, + EncryptionServices, + Endpoints, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + ErrorResponseAutoGenerated, + ErrorResponseBody, + ExecutionTarget, + ExecutionTrigger, + ExecutionTriggerUpdate, + ExtendedLocation, + FileServiceItems, + FileServiceProperties, + FileShare, + FileShareItem, + FileShareItems, + GeoReplicationStats, + IPRule, + Identity, + ImmutabilityPolicy, + ImmutabilityPolicyProperties, + ImmutableStorageAccount, + ImmutableStorageWithVersioning, + KeyCreationTime, + KeyPolicy, + KeyVaultProperties, + LastAccessTimeTrackingPolicy, + LeaseContainerRequest, + LeaseContainerResponse, + LeaseShareRequest, + LeaseShareResponse, + LegalHold, + LegalHoldProperties, + ListAccountSasResponse, + ListBlobInventoryPolicy, + ListContainerItem, + ListContainerItems, + ListQueue, + ListQueueResource, + ListQueueServices, + ListServiceSasResponse, + ListTableResource, + ListTableServices, + LocalUser, + LocalUserKeys, + LocalUserRegeneratePasswordResult, + LocalUsers, + ManagementPolicy, + ManagementPolicyAction, + ManagementPolicyBaseBlob, + ManagementPolicyDefinition, + ManagementPolicyFilter, + ManagementPolicyRule, + ManagementPolicySchema, + ManagementPolicySnapShot, + ManagementPolicyVersion, + MetricSpecification, + Multichannel, + NetworkRuleSet, + NetworkSecurityPerimeter, + NetworkSecurityPerimeterConfiguration, + NetworkSecurityPerimeterConfigurationList, + NetworkSecurityPerimeterConfigurationPropertiesProfile, + NetworkSecurityPerimeterConfigurationPropertiesResourceAssociation, + NspAccessRule, + NspAccessRuleProperties, + NspAccessRulePropertiesSubscriptionsItem, + ObjectReplicationPolicies, + ObjectReplicationPolicy, + ObjectReplicationPolicyFilter, + ObjectReplicationPolicyRule, + Operation, + OperationDisplay, + OperationListResult, + PermissionScope, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionListResult, + PrivateLinkResource, + PrivateLinkResourceListResult, + PrivateLinkServiceConnectionState, + ProtectedAppendWritesHistory, + ProtocolSettings, + ProvisioningIssue, + ProvisioningIssueProperties, + ProxyResource, + ProxyResourceAutoGenerated, + QueueServiceProperties, + Resource, + ResourceAccessRule, + ResourceAutoGenerated, + RestorePolicyProperties, + Restriction, + RoutingPreference, + SKUCapability, + SasPolicy, + ServiceSasParameters, + ServiceSpecification, + SignedIdentifier, + Sku, + SkuInformation, + SmbSetting, + SshPublicKey, + StorageAccount, + StorageAccountCheckNameAvailabilityParameters, + StorageAccountCreateParameters, + StorageAccountInternetEndpoints, + StorageAccountKey, + StorageAccountListKeysResult, + StorageAccountListResult, + StorageAccountMicrosoftEndpoints, + StorageAccountMigration, + StorageAccountRegenerateKeyParameters, + StorageAccountSkuConversionStatus, + StorageAccountUpdateParameters, + StorageQueue, + StorageSkuListResult, + StorageTaskAssignment, + StorageTaskAssignmentExecutionContext, + StorageTaskAssignmentProperties, + StorageTaskAssignmentReport, + StorageTaskAssignmentUpdateExecutionContext, + StorageTaskAssignmentUpdateParameters, + StorageTaskAssignmentUpdateProperties, + StorageTaskAssignmentUpdateReport, + StorageTaskAssignmentsList, + StorageTaskReportInstance, + StorageTaskReportProperties, + StorageTaskReportSummary, + SystemData, + Table, + TableAccessPolicy, + TableServiceProperties, + TableSignedIdentifier, + TagFilter, + TagProperty, + TrackedResource, + TriggerParameters, + TriggerParametersUpdate, + UpdateHistoryProperty, + Usage, + UsageListResult, + UsageName, + UserAssignedIdentity, + VirtualNetworkRule, +) + +from ._storage_management_client_enums import ( # type: ignore + AccessTier, + AccountImmutabilityPolicyState, + AccountStatus, + AccountType, + AllowedCopyScope, + AllowedMethods, + BlobInventoryPolicyName, + BlobRestoreProgressStatus, + Bypass, + CreatedByType, + DefaultAction, + DefaultSharePermission, + DirectoryServiceOptions, + DnsEndpointType, + EnabledProtocols, + EncryptionScopeSource, + EncryptionScopeState, + ExpirationAction, + ExtendedLocationTypes, + Format, + GeoReplicationStatus, + HttpProtocol, + IdentityType, + ImmutabilityPolicyState, + ImmutabilityPolicyUpdateType, + InventoryRuleType, + IssueType, + KeyPermission, + KeySource, + KeyType, + Kind, + LargeFileSharesState, + LeaseContainerRequestEnum, + LeaseDuration, + LeaseShareAction, + LeaseState, + LeaseStatus, + ListContainersInclude, + ListEncryptionScopesInclude, + ListLocalUserIncludeParam, + ManagementPolicyName, + MigrationName, + MigrationState, + MigrationStatus, + MinimumTlsVersion, + Name, + NetworkSecurityPerimeterConfigurationProvisioningState, + NspAccessRuleDirection, + ObjectType, + Permissions, + PostFailoverRedundancy, + PostPlannedFailoverRedundancy, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProvisioningState, + PublicAccess, + PublicNetworkAccess, + Reason, + ReasonCode, + ResourceAssociationAccessMode, + RootSquashType, + RoutingChoice, + RuleType, + RunResult, + RunStatusEnum, + Schedule, + Services, + Severity, + ShareAccessTier, + SignedResource, + SignedResourceTypes, + SkuConversionStatus, + SkuName, + SkuTier, + State, + StorageAccountExpand, + TriggerType, + UsageUnit, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -533,5 +544,5 @@ "TriggerType", "UsageUnit", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/models/_models_py3.py index c74c33699dcf..90c61b12f54f 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -13,7 +13,6 @@ from ... import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -440,7 +439,7 @@ def __init__( self.default_share_permission = default_share_permission -class BlobContainer(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class BlobContainer(AzureEntityResource): """Properties of the blob container, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -1142,7 +1141,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class BlobServiceProperties(Resource): # pylint: disable=too-many-instance-attributes +class BlobServiceProperties(Resource): """The properties of a storage account’s Blob service. Variables are only populated by the server, and will be ignored when sending a request. @@ -2651,7 +2650,7 @@ def __init__( self.protocol_settings = protocol_settings -class FileShare(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShare(AzureEntityResource): """Properties of the file share, including Id, resource name, resource type, Etag. Variables are only populated by the server, and will be ignored when sending a request. @@ -2809,7 +2808,7 @@ def __init__( self.snapshot_time = None -class FileShareItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class FileShareItem(AzureEntityResource): """The file share properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -3594,7 +3593,7 @@ class LeaseContainerRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2023_05_01.models.LeaseContainerRequestEnum :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -3633,7 +3632,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2023_05_01.models.LeaseContainerRequestEnum :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -3691,7 +3690,7 @@ class LeaseShareRequest(_serialization.Model): All required parameters must be populated in order to send to server. :ivar action: Specifies the lease action. Can be one of the available actions. Required. Known - values are: "Acquire", "Renew", "Change", "Release", and "Break". + values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :vartype action: str or ~azure.mgmt.storage.v2023_05_01.models.LeaseShareAction :ivar lease_id: Identifies the lease. Can be specified in any valid GUID string format. :vartype lease_id: str @@ -3730,7 +3729,7 @@ def __init__( ) -> None: """ :keyword action: Specifies the lease action. Can be one of the available actions. Required. - Known values are: "Acquire", "Renew", "Change", "Release", and "Break". + Known values are: "Acquire", "Renew", "Change", "Release", "Break", and "Break". :paramtype action: str or ~azure.mgmt.storage.v2023_05_01.models.LeaseShareAction :keyword lease_id: Identifies the lease. Can be specified in any valid GUID string format. :paramtype lease_id: str @@ -3928,7 +3927,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class ListContainerItem(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class ListContainerItem(AzureEntityResource): """The blob container properties be listed out. Variables are only populated by the server, and will be ignored when sending a request. @@ -4296,7 +4295,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class LocalUser(Resource): # pylint: disable=too-many-instance-attributes +class LocalUser(Resource): """The local user associated with the storage accounts. Variables are only populated by the server, and will be ignored when sending a request. @@ -6461,7 +6460,7 @@ def __init__( self.expiration_action = expiration_action -class ServiceSasParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ServiceSasParameters(_serialization.Model): """The parameters to list service SAS credentials of a specific resource. All required parameters must be populated in order to send to server. @@ -6895,7 +6894,7 @@ class SshPublicKey(_serialization.Model): :ivar description: Optional. It is used to store the function/usage of the key. :vartype description: str - :ivar key: Ssh public key base64 encoded. The format should be: ':code:`` + :ivar key: Ssh public key base64 encoded. The format should be: '\\ :code:`` :code:``', e.g. ssh-rsa AAAABBBB. :vartype key: str """ @@ -6909,7 +6908,7 @@ def __init__(self, *, description: Optional[str] = None, key: Optional[str] = No """ :keyword description: Optional. It is used to store the function/usage of the key. :paramtype description: str - :keyword key: Ssh public key base64 encoded. The format should be: ':code:`` + :keyword key: Ssh public key base64 encoded. The format should be: '\\ :code:`` :code:``', e.g. ssh-rsa AAAABBBB. :paramtype key: str """ @@ -6967,7 +6966,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class StorageAccount(TrackedResource): # pylint: disable=too-many-instance-attributes +class StorageAccount(TrackedResource): """The storage account. Variables are only populated by the server, and will be ignored when sending a request. @@ -7414,7 +7413,7 @@ def __init__(self, *, name: str, **kwargs: Any) -> None: self.name = name -class StorageAccountCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountCreateParameters(_serialization.Model): """The parameters used when creating a storage account. All required parameters must be populated in order to send to server. @@ -8071,7 +8070,7 @@ def __init__(self, *, target_sku_name: Optional[Union[str, "_models.SkuName"]] = self.end_time = None -class StorageAccountUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageAccountUpdateParameters(_serialization.Model): """The parameters that can be provided when updating the storage account properties. :ivar sku: Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS, @@ -8827,7 +8826,7 @@ def __init__(self, *, properties: Optional["_models.StorageTaskReportProperties" self.properties = properties -class StorageTaskReportProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes +class StorageTaskReportProperties(_serialization.Model): """Storage task execution report for a run instance. Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/models/_storage_management_client_enums.py index 2f2880a5b917..b3b0496d00f0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/models/_storage_management_client_enums.py @@ -307,6 +307,7 @@ class LeaseContainerRequestEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" @@ -326,6 +327,7 @@ class LeaseShareAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): RENEW = "Renew" CHANGE = "Change" RELEASE = "Release" + BREAK = "Break" BREAK_ENUM = "Break" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/__init__.py index e62e153ac4a1..18334b99b3ea 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/__init__.py @@ -5,34 +5,40 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._blob_services_operations import BlobServicesOperations -from ._blob_containers_operations import BlobContainersOperations -from ._file_services_operations import FileServicesOperations -from ._file_shares_operations import FileSharesOperations -from ._queue_services_operations import QueueServicesOperations -from ._queue_operations import QueueOperations -from ._operations import Operations -from ._skus_operations import SkusOperations -from ._storage_accounts_operations import StorageAccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._usages_operations import UsagesOperations -from ._management_policies_operations import ManagementPoliciesOperations -from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations -from ._local_users_operations import LocalUsersOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._table_services_operations import TableServicesOperations -from ._table_operations import TableOperations -from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations -from ._storage_task_assignments_operations import StorageTaskAssignmentsOperations -from ._storage_task_assignments_instances_report_operations import StorageTaskAssignmentsInstancesReportOperations -from ._storage_task_assignment_instances_report_operations import StorageTaskAssignmentInstancesReportOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._blob_services_operations import BlobServicesOperations # type: ignore +from ._blob_containers_operations import BlobContainersOperations # type: ignore +from ._file_services_operations import FileServicesOperations # type: ignore +from ._file_shares_operations import FileSharesOperations # type: ignore +from ._queue_services_operations import QueueServicesOperations # type: ignore +from ._queue_operations import QueueOperations # type: ignore +from ._operations import Operations # type: ignore +from ._skus_operations import SkusOperations # type: ignore +from ._storage_accounts_operations import StorageAccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._management_policies_operations import ManagementPoliciesOperations # type: ignore +from ._blob_inventory_policies_operations import BlobInventoryPoliciesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations # type: ignore +from ._local_users_operations import LocalUsersOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._table_services_operations import TableServicesOperations # type: ignore +from ._table_operations import TableOperations # type: ignore +from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore +from ._storage_task_assignments_operations import StorageTaskAssignmentsOperations # type: ignore +from ._storage_task_assignments_instances_report_operations import StorageTaskAssignmentsInstancesReportOperations # type: ignore +from ._storage_task_assignment_instances_report_operations import StorageTaskAssignmentInstancesReportOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -61,5 +67,5 @@ "StorageTaskAssignmentsInstancesReportOperations", "StorageTaskAssignmentInstancesReportOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_blob_containers_operations.py index d32a67793c77..3dd86b4432b9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_blob_containers_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_blob_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -677,7 +677,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.ListContainerItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -699,7 +699,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -715,7 +714,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -850,7 +848,7 @@ def create( :rtype: ~azure.mgmt.storage.v2023_05_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -885,7 +883,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -899,11 +896,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1013,7 +1006,7 @@ def update( :rtype: ~azure.mgmt.storage.v2023_05_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1048,7 +1041,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1062,7 +1054,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1091,7 +1083,7 @@ def get( :rtype: ~azure.mgmt.storage.v2023_05_01.models.BlobContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1114,7 +1106,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1128,7 +1119,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobContainer", pipeline_response) + deserialized = self._deserialize("BlobContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1157,7 +1148,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1180,7 +1171,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1303,7 +1293,7 @@ def set_legal_hold( :rtype: ~azure.mgmt.storage.v2023_05_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1338,7 +1328,6 @@ def set_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1352,7 +1341,7 @@ def set_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1462,7 +1451,7 @@ def clear_legal_hold( :rtype: ~azure.mgmt.storage.v2023_05_01.models.LegalHold :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1497,7 +1486,6 @@ def clear_legal_hold( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1511,7 +1499,7 @@ def clear_legal_hold( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LegalHold", pipeline_response) + deserialized = self._deserialize("LegalHold", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1545,9 +1533,9 @@ def create_or_update_immutability_policy( letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required. :type container_name: str - :param if_match: The entity state (ETag) version of the immutability policy to update. A value - of "*" can be used to apply the operation only if the immutability policy already exists. If - omitted, this operation will always be applied. Default value is None. + :param if_match: The entity state (ETag) version of the immutability policy to update must be + returned to the server for all update operations. The ETag value must include the leading and + trailing double quotes as returned by the service. Default value is None. :type if_match: str :param parameters: The ImmutabilityPolicy Properties that will be created or updated to a blob container. Default value is None. @@ -1587,9 +1575,9 @@ def create_or_update_immutability_policy( letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required. :type container_name: str - :param if_match: The entity state (ETag) version of the immutability policy to update. A value - of "*" can be used to apply the operation only if the immutability policy already exists. If - omitted, this operation will always be applied. Default value is None. + :param if_match: The entity state (ETag) version of the immutability policy to update must be + returned to the server for all update operations. The ETag value must include the leading and + trailing double quotes as returned by the service. Default value is None. :type if_match: str :param parameters: The ImmutabilityPolicy Properties that will be created or updated to a blob container. Default value is None. @@ -1627,9 +1615,9 @@ def create_or_update_immutability_policy( letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required. :type container_name: str - :param if_match: The entity state (ETag) version of the immutability policy to update. A value - of "*" can be used to apply the operation only if the immutability policy already exists. If - omitted, this operation will always be applied. Default value is None. + :param if_match: The entity state (ETag) version of the immutability policy to update must be + returned to the server for all update operations. The ETag value must include the leading and + trailing double quotes as returned by the service. Default value is None. :type if_match: str :param parameters: The ImmutabilityPolicy Properties that will be created or updated to a blob container. Is either a ImmutabilityPolicy type or a IO[bytes] type. Default value is None. @@ -1638,7 +1626,7 @@ def create_or_update_immutability_policy( :rtype: ~azure.mgmt.storage.v2023_05_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1679,7 +1667,6 @@ def create_or_update_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1696,7 +1683,7 @@ def create_or_update_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1727,15 +1714,15 @@ def get_immutability_policy( letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required. :type container_name: str - :param if_match: The entity state (ETag) version of the immutability policy to update. A value - of "*" can be used to apply the operation only if the immutability policy already exists. If - omitted, this operation will always be applied. Default value is None. + :param if_match: The entity state (ETag) version of the immutability policy to update must be + returned to the server for all update operations. The ETag value must include the leading and + trailing double quotes as returned by the service. Default value is None. :type if_match: str :return: ImmutabilityPolicy or the result of cls(response) :rtype: ~azure.mgmt.storage.v2023_05_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1761,7 +1748,6 @@ def get_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1778,7 +1764,7 @@ def get_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1806,15 +1792,15 @@ def delete_immutability_policy( letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required. :type container_name: str - :param if_match: The entity state (ETag) version of the immutability policy to update. A value - of "*" can be used to apply the operation only if the immutability policy already exists. If - omitted, this operation will always be applied. Required. + :param if_match: The entity state (ETag) version of the immutability policy to update must be + returned to the server for all update operations. The ETag value must include the leading and + trailing double quotes as returned by the service. Required. :type if_match: str :return: ImmutabilityPolicy or the result of cls(response) :rtype: ~azure.mgmt.storage.v2023_05_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1840,7 +1826,6 @@ def delete_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1857,7 +1842,7 @@ def delete_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1883,15 +1868,15 @@ def lock_immutability_policy( letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required. :type container_name: str - :param if_match: The entity state (ETag) version of the immutability policy to update. A value - of "*" can be used to apply the operation only if the immutability policy already exists. If - omitted, this operation will always be applied. Required. + :param if_match: The entity state (ETag) version of the immutability policy to update must be + returned to the server for all update operations. The ETag value must include the leading and + trailing double quotes as returned by the service. Required. :type if_match: str :return: ImmutabilityPolicy or the result of cls(response) :rtype: ~azure.mgmt.storage.v2023_05_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1915,7 +1900,6 @@ def lock_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1932,7 +1916,7 @@ def lock_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1967,9 +1951,9 @@ def extend_immutability_policy( letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required. :type container_name: str - :param if_match: The entity state (ETag) version of the immutability policy to update. A value - of "*" can be used to apply the operation only if the immutability policy already exists. If - omitted, this operation will always be applied. Required. + :param if_match: The entity state (ETag) version of the immutability policy to update must be + returned to the server for all update operations. The ETag value must include the leading and + trailing double quotes as returned by the service. Required. :type if_match: str :param parameters: The ImmutabilityPolicy Properties that will be extended for a blob container. Default value is None. @@ -2010,9 +1994,9 @@ def extend_immutability_policy( letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required. :type container_name: str - :param if_match: The entity state (ETag) version of the immutability policy to update. A value - of "*" can be used to apply the operation only if the immutability policy already exists. If - omitted, this operation will always be applied. Required. + :param if_match: The entity state (ETag) version of the immutability policy to update must be + returned to the server for all update operations. The ETag value must include the leading and + trailing double quotes as returned by the service. Required. :type if_match: str :param parameters: The ImmutabilityPolicy Properties that will be extended for a blob container. Default value is None. @@ -2051,9 +2035,9 @@ def extend_immutability_policy( letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required. :type container_name: str - :param if_match: The entity state (ETag) version of the immutability policy to update. A value - of "*" can be used to apply the operation only if the immutability policy already exists. If - omitted, this operation will always be applied. Required. + :param if_match: The entity state (ETag) version of the immutability policy to update must be + returned to the server for all update operations. The ETag value must include the leading and + trailing double quotes as returned by the service. Required. :type if_match: str :param parameters: The ImmutabilityPolicy Properties that will be extended for a blob container. Is either a ImmutabilityPolicy type or a IO[bytes] type. Default value is None. @@ -2062,7 +2046,7 @@ def extend_immutability_policy( :rtype: ~azure.mgmt.storage.v2023_05_01.models.ImmutabilityPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2101,7 +2085,6 @@ def extend_immutability_policy( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2118,7 +2101,7 @@ def extend_immutability_policy( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response) + deserialized = self._deserialize("ImmutabilityPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -2228,7 +2211,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2023_05_01.models.LeaseContainerResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2266,7 +2249,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2280,17 +2262,17 @@ def lease( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("LeaseContainerResponse", pipeline_response) + deserialized = self._deserialize("LeaseContainerResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _object_level_worm_initial( # pylint: disable=inconsistent-return-statements + def _object_level_worm_initial( self, resource_group_name: str, account_name: str, container_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2302,7 +2284,7 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_object_level_worm_request( resource_group_name=resource_group_name, @@ -2313,10 +2295,10 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2324,11 +2306,19 @@ def _object_level_worm_initial( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_object_level_worm( @@ -2364,7 +2354,7 @@ def begin_object_level_worm( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._object_level_worm_initial( # type: ignore + raw_result = self._object_level_worm_initial( resource_group_name=resource_group_name, account_name=account_name, container_name=container_name, @@ -2374,6 +2364,7 @@ def begin_object_level_worm( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_blob_inventory_policies_operations.py index 9f6143916daa..06e160463f59 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_blob_inventory_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_blob_inventory_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -243,7 +240,7 @@ def get( :rtype: ~azure.mgmt.storage.v2023_05_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -266,7 +263,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -280,7 +276,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -384,7 +380,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2023_05_01.models.BlobInventoryPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -419,7 +415,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -433,7 +428,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response) + deserialized = self._deserialize("BlobInventoryPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -465,7 +460,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -488,7 +483,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -529,7 +523,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.ListBlobInventoryPolicy] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -548,7 +542,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -564,7 +557,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_blob_services_operations.py index ffd1e667b709..f12d7665321d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_blob_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_blob_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -197,7 +194,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.BlobServiceItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -216,7 +213,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -232,7 +228,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -349,7 +344,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2023_05_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -385,7 +380,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -399,7 +393,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -424,7 +418,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2023_05_01.models.BlobServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -448,7 +442,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -462,7 +455,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("BlobServiceProperties", pipeline_response) + deserialized = self._deserialize("BlobServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_deleted_accounts_operations.py index 398456eab3ca..6a77d39db4c1 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_deleted_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -130,7 +127,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.DeletedAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.DeletedAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -147,7 +144,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -163,7 +159,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -205,7 +200,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model :rtype: ~azure.mgmt.storage.v2023_05_01.models.DeletedAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +222,6 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -242,7 +236,7 @@ def get(self, deleted_account_name: str, location: str, **kwargs: Any) -> _model error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeletedAccount", pipeline_response) + deserialized = self._deserialize("DeletedAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_encryption_scopes_operations.py index b61140c015fa..89b8a8e34d83 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_encryption_scopes_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -338,7 +335,7 @@ def put( :rtype: ~azure.mgmt.storage.v2023_05_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -373,7 +370,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -388,11 +384,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EncryptionScope", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -502,7 +494,7 @@ def patch( :rtype: ~azure.mgmt.storage.v2023_05_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -537,7 +529,6 @@ def patch( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -552,7 +543,7 @@ def patch( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -581,7 +572,7 @@ def get( :rtype: ~azure.mgmt.storage.v2023_05_01.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -604,7 +595,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -619,7 +609,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EncryptionScope", pipeline_response) + deserialized = self._deserialize("EncryptionScope", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -664,7 +654,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -686,7 +676,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -702,7 +691,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_file_services_operations.py index 09a9851186bd..352a8ccb303d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_file_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2023_05_01.models.FileServiceItems :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +204,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -221,7 +217,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceItems", pipeline_response) + deserialized = self._deserialize("FileServiceItems", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -316,7 +312,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2023_05_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -352,7 +348,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -366,7 +361,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -391,7 +386,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2023_05_01.models.FileServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -415,7 +410,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -429,7 +423,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileServiceProperties", pipeline_response) + deserialized = self._deserialize("FileServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_file_shares_operations.py index d042bee52013..6ad1af90d0cc 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_file_shares_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -415,7 +413,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.FileShareItems] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -437,7 +435,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -453,7 +450,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -600,7 +596,7 @@ def create( :rtype: ~azure.mgmt.storage.v2023_05_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -636,7 +632,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -650,11 +645,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("FileShare", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -764,7 +755,7 @@ def update( :rtype: ~azure.mgmt.storage.v2023_05_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -799,7 +790,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -813,7 +803,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -854,7 +844,7 @@ def get( :rtype: ~azure.mgmt.storage.v2023_05_01.models.FileShare :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -879,7 +869,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -893,7 +882,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileShare", pipeline_response) + deserialized = self._deserialize("FileShare", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -938,7 +927,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -963,7 +952,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -981,7 +969,7 @@ def delete( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -1016,7 +1004,7 @@ def restore( # pylint: disable=inconsistent-return-statements """ @overload - def restore( # pylint: disable=inconsistent-return-statements + def restore( self, resource_group_name: str, account_name: str, @@ -1079,7 +1067,7 @@ def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1114,7 +1102,6 @@ def restore( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1246,7 +1233,7 @@ def lease( :rtype: ~azure.mgmt.storage.v2023_05_01.models.LeaseShareResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1285,7 +1272,6 @@ def lease( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1302,7 +1288,7 @@ def lease( response_headers = {} response_headers["ETag"] = self._deserialize("str", response.headers.get("ETag")) - deserialized = self._deserialize("LeaseShareResponse", pipeline_response) + deserialized = self._deserialize("LeaseShareResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_local_users_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_local_users_operations.py index 18f3dc431281..dc804b0c9bb3 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_local_users_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_local_users_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -331,7 +328,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.LocalUsers] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,7 +350,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -369,7 +365,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -417,7 +412,7 @@ def get(self, resource_group_name: str, account_name: str, username: str, **kwar :rtype: ~azure.mgmt.storage.v2023_05_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -440,7 +435,6 @@ def get(self, resource_group_name: str, account_name: str, username: str, **kwar headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -455,7 +449,7 @@ def get(self, resource_group_name: str, account_name: str, username: str, **kwar error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -559,7 +553,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2023_05_01.models.LocalUser :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -594,7 +588,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -609,7 +602,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUser", pipeline_response) + deserialized = self._deserialize("LocalUser", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -636,7 +629,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -659,7 +652,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -697,7 +689,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2023_05_01.models.LocalUserKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -720,7 +712,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -735,7 +726,7 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserKeys", pipeline_response) + deserialized = self._deserialize("LocalUserKeys", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -762,7 +753,7 @@ def regenerate_password( :rtype: ~azure.mgmt.storage.v2023_05_01.models.LocalUserRegeneratePasswordResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -785,7 +776,6 @@ def regenerate_password( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -800,7 +790,7 @@ def regenerate_password( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response) + deserialized = self._deserialize("LocalUserRegeneratePasswordResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_management_policies_operations.py index cca94e4940b5..742075be5763 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_management_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_management_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -202,7 +199,7 @@ def get( :rtype: ~azure.mgmt.storage.v2023_05_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -225,7 +222,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -239,7 +235,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -343,7 +339,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2023_05_01.models.ManagementPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -378,7 +374,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -392,7 +387,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ManagementPolicy", pipeline_response) + deserialized = self._deserialize("ManagementPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -424,7 +419,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -447,7 +442,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_network_security_perimeter_configurations_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_network_security_perimeter_configurations_operations.py index 0169a10d74bd..ff7ae649449d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_network_security_perimeter_configurations_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_network_security_perimeter_configurations_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Iterable, Iterator, Optional, TypeVar, Union, cast import urllib.parse from azure.core.exceptions import ( @@ -16,13 +15,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,12 +30,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -211,7 +210,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.NetworkSecurityPerimeterConfigurationList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -230,7 +229,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -246,7 +244,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -300,7 +297,7 @@ def get( :rtype: ~azure.mgmt.storage.v2023_05_01.models.NetworkSecurityPerimeterConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -323,7 +320,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -338,21 +334,21 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response) + deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _reconcile_initial( # pylint: disable=inconsistent-return-statements + def _reconcile_initial( self, resource_group_name: str, account_name: str, network_security_perimeter_configuration_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -364,7 +360,7 @@ def _reconcile_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_reconcile_request( resource_group_name=resource_group_name, @@ -375,10 +371,10 @@ def _reconcile_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -386,6 +382,10 @@ def _reconcile_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -393,8 +393,12 @@ def _reconcile_initial( # pylint: disable=inconsistent-return-statements response_headers = {} response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_reconcile( @@ -429,7 +433,7 @@ def begin_reconcile( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._reconcile_initial( # type: ignore + raw_result = self._reconcile_initial( resource_group_name=resource_group_name, account_name=account_name, network_security_perimeter_configuration_name=network_security_perimeter_configuration_name, @@ -439,6 +443,7 @@ def begin_reconcile( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_object_replication_policies_operations.py index 31b830139956..2a7352c55cdd 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_object_replication_policies_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_object_replication_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -237,7 +234,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.ObjectReplicationPolicies] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -256,7 +253,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -272,7 +268,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -324,7 +319,7 @@ def get( :rtype: ~azure.mgmt.storage.v2023_05_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -347,7 +342,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -362,7 +356,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -472,7 +466,7 @@ def create_or_update( :rtype: ~azure.mgmt.storage.v2023_05_01.models.ObjectReplicationPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -507,7 +501,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -522,7 +515,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response) + deserialized = self._deserialize("ObjectReplicationPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -551,7 +544,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -574,7 +567,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_operations.py index 4a22fa107df6..55024e1890bf 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +91,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -126,7 +122,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_private_endpoint_connections_operations.py index 208024e89447..732e198e3545 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -249,7 +246,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -268,7 +265,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -284,7 +280,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -333,7 +328,7 @@ def get( :rtype: ~azure.mgmt.storage.v2023_05_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -356,7 +351,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -371,7 +365,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -472,7 +466,7 @@ def put( :rtype: ~azure.mgmt.storage.v2023_05_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -507,7 +501,6 @@ def put( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -522,7 +515,7 @@ def put( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -549,7 +542,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -572,7 +565,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_private_link_resources_operations.py index 97fbf7cfb78f..d43255bee032 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_private_link_resources_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -111,7 +108,7 @@ def list_by_storage_account( :rtype: ~azure.mgmt.storage.v2023_05_01.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -133,7 +130,6 @@ def list_by_storage_account( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -147,7 +143,7 @@ def list_by_storage_account( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_queue_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_queue_operations.py index 0f1af08d4e05..cfbb67045e3c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_queue_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_queue_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -385,7 +382,7 @@ def create( :rtype: ~azure.mgmt.storage.v2023_05_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -420,7 +417,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -434,7 +430,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -541,7 +537,7 @@ def update( :rtype: ~azure.mgmt.storage.v2023_05_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -576,7 +572,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -590,7 +585,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -617,7 +612,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw :rtype: ~azure.mgmt.storage.v2023_05_01.models.StorageQueue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -640,7 +635,6 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -654,7 +648,7 @@ def get(self, resource_group_name: str, account_name: str, queue_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageQueue", pipeline_response) + deserialized = self._deserialize("StorageQueue", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -683,7 +677,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -706,7 +700,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -757,7 +750,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.ListQueueResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -778,7 +771,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -794,7 +786,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_queue_services_operations.py index 5000085e380e..a68ce95f429b 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_queue_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_queue_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2023_05_01.models.ListQueueServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +204,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -221,7 +217,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListQueueServices", pipeline_response) + deserialized = self._deserialize("ListQueueServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -316,7 +312,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2023_05_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -352,7 +348,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -366,7 +361,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -391,7 +386,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2023_05_01.models.QueueServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -415,7 +410,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -429,7 +423,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("QueueServiceProperties", pipeline_response) + deserialized = self._deserialize("QueueServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_skus_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_skus_operations.py index bb41df7d34a8..a2c86e63f8b0 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_skus_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +96,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SkuInformation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.StorageSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -132,7 +128,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_storage_accounts_operations.py index 2574c28e8b16..b1f182b3132a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_storage_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -758,7 +758,7 @@ def check_name_availability( :rtype: ~azure.mgmt.storage.v2023_05_01.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -790,7 +790,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -804,7 +803,7 @@ def check_name_availability( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -817,8 +816,8 @@ def _create_initial( account_name: str, parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageAccount]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -831,7 +830,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageAccount]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -852,10 +851,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -863,12 +862,14 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -991,10 +992,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1033,7 +1035,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1055,7 +1057,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1100,7 +1101,7 @@ def get_properties( :rtype: ~azure.mgmt.storage.v2023_05_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1123,7 +1124,6 @@ def get_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1137,7 +1137,7 @@ def get_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1248,7 +1248,7 @@ def update( :rtype: ~azure.mgmt.storage.v2023_05_01.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1282,7 +1282,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1296,7 +1295,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccount", pipeline_response) + deserialized = self._deserialize("StorageAccount", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1318,7 +1317,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1335,7 +1334,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1351,7 +1349,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1398,7 +1395,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1416,7 +1413,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1432,7 +1428,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1482,7 +1477,7 @@ def list_keys( :rtype: ~azure.mgmt.storage.v2023_05_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1505,7 +1500,6 @@ def list_keys( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1519,7 +1513,7 @@ def list_keys( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1613,7 +1607,7 @@ def regenerate_key( :rtype: ~azure.mgmt.storage.v2023_05_01.models.StorageAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1647,7 +1641,6 @@ def regenerate_key( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1661,7 +1654,7 @@ def regenerate_key( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response) + deserialized = self._deserialize("StorageAccountListKeysResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1752,7 +1745,7 @@ def list_account_sas( :rtype: ~azure.mgmt.storage.v2023_05_01.models.ListAccountSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1786,7 +1779,6 @@ def list_account_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1800,7 +1792,7 @@ def list_account_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListAccountSasResponse", pipeline_response) + deserialized = self._deserialize("ListAccountSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1889,7 +1881,7 @@ def list_service_sas( :rtype: ~azure.mgmt.storage.v2023_05_01.models.ListServiceSasResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1923,7 +1915,6 @@ def list_service_sas( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1937,17 +1928,17 @@ def list_service_sas( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListServiceSasResponse", pipeline_response) + deserialized = self._deserialize("ListServiceSasResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _failover_initial( # pylint: disable=inconsistent-return-statements + def _failover_initial( self, resource_group_name: str, account_name: str, failover_type: Literal["Planned"] = "Planned", **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1959,7 +1950,7 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_failover_request( resource_group_name=resource_group_name, @@ -1970,10 +1961,10 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1981,11 +1972,19 @@ def _failover_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_failover( @@ -2026,7 +2025,7 @@ def begin_failover( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._failover_initial( # type: ignore + raw_result = self._failover_initial( resource_group_name=resource_group_name, account_name=account_name, failover_type=failover_type, @@ -2036,6 +2035,7 @@ def begin_failover( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2059,10 +2059,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, request_type: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2074,7 +2074,7 @@ def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-r _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -2085,10 +2085,10 @@ def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-r headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2096,12 +2096,20 @@ def _hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-r response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_hierarchical_namespace_migration( @@ -2134,7 +2142,7 @@ def begin_hierarchical_namespace_migration( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._hierarchical_namespace_migration_initial( # type: ignore + raw_result = self._hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, request_type=request_type, @@ -2144,6 +2152,7 @@ def begin_hierarchical_namespace_migration( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2167,10 +2176,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsistent-return-statements,name-too-long + def _abort_hierarchical_namespace_migration_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2182,7 +2191,7 @@ def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_abort_hierarchical_namespace_migration_request( resource_group_name=resource_group_name, @@ -2192,10 +2201,10 @@ def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2203,12 +2212,20 @@ def _abort_hierarchical_namespace_migration_initial( # pylint: disable=inconsis response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-long @@ -2236,7 +2253,7 @@ def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-lo lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._abort_hierarchical_namespace_migration_initial( # type: ignore + raw_result = self._abort_hierarchical_namespace_migration_initial( resource_group_name=resource_group_name, account_name=account_name, api_version=api_version, @@ -2245,6 +2262,7 @@ def begin_abort_hierarchical_namespace_migration( # pylint: disable=name-too-lo params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2268,14 +2286,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _customer_initiated_migration_initial( # pylint: disable=inconsistent-return-statements + def _customer_initiated_migration_initial( self, resource_group_name: str, account_name: str, parameters: Union[_models.StorageAccountMigration, IO[bytes]], **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2288,7 +2306,7 @@ def _customer_initiated_migration_initial( # pylint: disable=inconsistent-retur api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2309,10 +2327,10 @@ def _customer_initiated_migration_initial( # pylint: disable=inconsistent-retur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2320,6 +2338,10 @@ def _customer_initiated_migration_initial( # pylint: disable=inconsistent-retur response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -2328,8 +2350,12 @@ def _customer_initiated_migration_initial( # pylint: disable=inconsistent-retur if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload def begin_customer_initiated_migration( @@ -2437,7 +2463,7 @@ def begin_customer_initiated_migration( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._customer_initiated_migration_initial( # type: ignore + raw_result = self._customer_initiated_migration_initial( resource_group_name=resource_group_name, account_name=account_name, parameters=parameters, @@ -2448,6 +2474,7 @@ def begin_customer_initiated_migration( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -2495,7 +2522,7 @@ def get_customer_initiated_migration( :rtype: ~azure.mgmt.storage.v2023_05_01.models.StorageAccountMigration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2518,7 +2545,6 @@ def get_customer_initiated_migration( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -2533,7 +2559,7 @@ def get_customer_initiated_migration( error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageAccountMigration", pipeline_response) + deserialized = self._deserialize("StorageAccountMigration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2546,8 +2572,8 @@ def _restore_blob_ranges_initial( account_name: str, parameters: Union[_models.BlobRestoreParameters, IO[bytes]], **kwargs: Any - ) -> _models.BlobRestoreStatus: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2560,7 +2586,7 @@ def _restore_blob_ranges_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BlobRestoreStatus] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2581,10 +2607,10 @@ def _restore_blob_ranges_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -2592,14 +2618,14 @@ def _restore_blob_ranges_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -2712,10 +2738,11 @@ def begin_restore_blob_ranges( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BlobRestoreStatus", pipeline_response) + deserialized = self._deserialize("BlobRestoreStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2756,7 +2783,7 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2778,7 +2805,6 @@ def revoke_user_delegation_keys( # pylint: disable=inconsistent-return-statemen headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_storage_task_assignment_instances_report_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_storage_task_assignment_instances_report_operations.py index 34765c39c0f4..87085a027282 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_storage_task_assignment_instances_report_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_storage_task_assignment_instances_report_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -125,6 +122,7 @@ def list( filter: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.StorageTaskReportInstance"]: + # pylint: disable=line-too-long """Fetch the report summary of a single storage task assignment's instances. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -158,7 +156,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.StorageTaskReportSummary] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -180,7 +178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -196,7 +193,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_storage_task_assignments_instances_report_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_storage_task_assignments_instances_report_operations.py index b3a48e443c78..be0537874d68 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_storage_task_assignments_instances_report_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_storage_task_assignments_instances_report_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -115,6 +112,7 @@ def list( filter: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.StorageTaskReportInstance"]: + # pylint: disable=line-too-long """Fetch the report summary of all the storage task assignments and instances in an account. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -144,7 +142,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.StorageTaskReportSummary] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -165,7 +163,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -181,7 +178,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_storage_task_assignments_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_storage_task_assignments_operations.py index 56faed5628a1..65bd194305ce 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_storage_task_assignments_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_storage_task_assignments_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,12 +32,11 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -291,8 +291,8 @@ def _create_initial( storage_task_assignment_name: str, parameters: Union[_models.StorageTaskAssignment, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageTaskAssignment]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -305,7 +305,7 @@ def _create_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageTaskAssignment]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -327,10 +327,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -338,21 +338,20 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("StorageTaskAssignment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("StorageTaskAssignment", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -495,10 +494,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageTaskAssignment", pipeline_response) + deserialized = self._deserialize("StorageTaskAssignment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -529,8 +529,8 @@ def _update_initial( storage_task_assignment_name: str, parameters: Union[_models.StorageTaskAssignmentUpdateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.StorageTaskAssignment]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -543,7 +543,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.StorageTaskAssignment]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -565,10 +565,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -576,18 +576,20 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("StorageTaskAssignment", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -719,10 +721,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("StorageTaskAssignment", pipeline_response) + deserialized = self._deserialize("StorageTaskAssignment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -767,7 +770,7 @@ def get( :rtype: ~azure.mgmt.storage.v2023_05_01.models.StorageTaskAssignment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -790,7 +793,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -805,17 +807,17 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("StorageTaskAssignment", pipeline_response) + deserialized = self._deserialize("StorageTaskAssignment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, account_name: str, storage_task_assignment_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -827,7 +829,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -838,10 +840,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -849,6 +851,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -857,8 +863,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -890,7 +900,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, account_name=account_name, storage_task_assignment_name=storage_task_assignment_name, @@ -900,6 +910,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -951,7 +962,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.StorageTaskAssignmentsList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -971,7 +982,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -987,7 +997,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_table_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_table_operations.py index 0950d5cfb466..54bdd2874f5d 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_table_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_table_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -350,7 +347,7 @@ def create( :rtype: ~azure.mgmt.storage.v2023_05_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -388,7 +385,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -402,7 +398,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -506,7 +502,7 @@ def update( :rtype: ~azure.mgmt.storage.v2023_05_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -544,7 +540,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -558,7 +553,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -584,7 +579,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw :rtype: ~azure.mgmt.storage.v2023_05_01.models.Table :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -607,7 +602,6 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -621,7 +615,7 @@ def get(self, resource_group_name: str, account_name: str, table_name: str, **kw map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Table", pipeline_response) + deserialized = self._deserialize("Table", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -649,7 +643,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -672,7 +666,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -710,7 +703,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.ListTableResource] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -729,7 +722,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -745,7 +737,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_table_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_table_services_operations.py index 509118c8dea7..fe242dac6140 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_table_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_table_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,20 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -185,7 +182,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.storage.v2023_05_01.models.ListTableServices :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +204,6 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -221,7 +217,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListTableServices", pipeline_response) + deserialized = self._deserialize("ListTableServices", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -316,7 +312,7 @@ def set_service_properties( :rtype: ~azure.mgmt.storage.v2023_05_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -352,7 +348,6 @@ def set_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -366,7 +361,7 @@ def set_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -391,7 +386,7 @@ def get_service_properties( :rtype: ~azure.mgmt.storage.v2023_05_01.models.TableServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -415,7 +410,6 @@ def get_service_properties( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -429,7 +423,7 @@ def get_service_properties( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TableServiceProperties", pipeline_response) + deserialized = self._deserialize("TableServiceProperties", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_usages_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_usages_operations.py index a14425f4335a..a773cd696cf8 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_usages_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2023_05_01/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -105,7 +102,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.Us api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-05-01")) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,7 +120,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -139,7 +135,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/blob_containers_patch.py b/sdk/storage/azure-mgmt-storage/generated_samples/blob_containers_patch.py index c047abeebb38..f6246fc9a64c 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/blob_containers_patch.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/blob_containers_patch.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/blob_containers_put_default_encryption_scope.py b/sdk/storage/azure-mgmt-storage/generated_samples/blob_containers_put_default_encryption_scope.py index f9b77e9611f6..dbaaeda23a7b 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/blob_containers_put_default_encryption_scope.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/blob_containers_put_default_encryption_scope.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/blob_containers_put_object_level_worm.py b/sdk/storage/azure-mgmt-storage/generated_samples/blob_containers_put_object_level_worm.py index 14030b7fd92c..91922d681be7 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/blob_containers_put_object_level_worm.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/blob_containers_put_object_level_worm.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/blob_ranges_restore.py b/sdk/storage/azure-mgmt-storage/generated_samples/blob_ranges_restore.py index 87345687a7c0..aa1d7cd3d98e 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/blob_ranges_restore.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/blob_ranges_restore.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/blob_services_put.py b/sdk/storage/azure-mgmt-storage/generated_samples/blob_services_put.py index 8d7333f0e759..b3dbfa90e9a8 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/blob_services_put.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/blob_services_put.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/blob_services_put_allow_permanent_delete.py b/sdk/storage/azure-mgmt-storage/generated_samples/blob_services_put_allow_permanent_delete.py index 02431ce8c2c8..9b8836919145 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/blob_services_put_allow_permanent_delete.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/blob_services_put_allow_permanent_delete.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/blob_services_put_last_access_time_based_tracking.py b/sdk/storage/azure-mgmt-storage/generated_samples/blob_services_put_last_access_time_based_tracking.py index ca7a52356b80..e73240729067 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/blob_services_put_last_access_time_based_tracking.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/blob_services_put_last_access_time_based_tracking.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/file_services_put.py b/sdk/storage/azure-mgmt-storage/generated_samples/file_services_put.py index 3c8a31f1da50..2b56ec96b2e8 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/file_services_put.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/file_services_put.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/file_services_put_enable_secure_smb_features.py b/sdk/storage/azure-mgmt-storage/generated_samples/file_services_put_enable_secure_smb_features.py index 5317baba8232..986d4cfdff82 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/file_services_put_enable_secure_smb_features.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/file_services_put_enable_secure_smb_features.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/file_services_put_enable_smb_multichannel.py b/sdk/storage/azure-mgmt-storage/generated_samples/file_services_put_enable_smb_multichannel.py index 384d000492b4..9065a1a965f5 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/file_services_put_enable_smb_multichannel.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/file_services_put_enable_smb_multichannel.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/file_share_acls_patch.py b/sdk/storage/azure-mgmt-storage/generated_samples/file_share_acls_patch.py index 287ea96f5ee6..47390379aeeb 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/file_share_acls_patch.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/file_share_acls_patch.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/file_shares_patch.py b/sdk/storage/azure-mgmt-storage/generated_samples/file_shares_patch.py index 12117c36f6ea..cb4b2011daec 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/file_shares_patch.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/file_shares_patch.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/file_shares_put_access_tier.py b/sdk/storage/azure-mgmt-storage/generated_samples/file_shares_put_access_tier.py index 1e569c217ff6..22055adeead2 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/file_shares_put_access_tier.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/file_shares_put_access_tier.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/file_shares_put_nfs.py b/sdk/storage/azure-mgmt-storage/generated_samples/file_shares_put_nfs.py index aeb4757e623d..63d60fb3c3e5 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/file_shares_put_nfs.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/file_shares_put_nfs.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/file_shares_restore.py b/sdk/storage/azure-mgmt-storage/generated_samples/file_shares_restore.py index a48b7319547a..3b9c653ac806 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/file_shares_restore.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/file_shares_restore.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/local_user_create.py b/sdk/storage/azure-mgmt-storage/generated_samples/local_user_create.py index 86a58f18e116..43cb7d7dab80 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/local_user_create.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/local_user_create.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/local_user_create_nf_sv3_enabled.py b/sdk/storage/azure-mgmt-storage/generated_samples/local_user_create_nf_sv3_enabled.py index 345bba3efcc9..0a0865f9c524 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/local_user_create_nf_sv3_enabled.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/local_user_create_nf_sv3_enabled.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/local_user_update.py b/sdk/storage/azure-mgmt-storage/generated_samples/local_user_update.py index 0dae42be8134..b8594abb640e 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/local_user_update.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/local_user_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/nfs_v3_account_create.py b/sdk/storage/azure-mgmt-storage/generated_samples/nfs_v3_account_create.py index 5f8d6c779983..caa611262e73 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/nfs_v3_account_create.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/nfs_v3_account_create.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/queue_operation_put_with_metadata.py b/sdk/storage/azure-mgmt-storage/generated_samples/queue_operation_put_with_metadata.py index 69e9ab2d0f9f..73a331a0c6d3 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/queue_operation_put_with_metadata.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/queue_operation_put_with_metadata.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/queue_services_put.py b/sdk/storage/azure-mgmt-storage/generated_samples/queue_services_put.py index 57522ee7e201..cc31e31b12a4 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/queue_services_put.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/queue_services_put.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_check_name_availability.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_check_name_availability.py index eedccac9cefd..ec486992536a 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_check_name_availability.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_check_name_availability.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create.py index d28e4807c29f..fe876827ede1 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_allowed_copy_scope_to_aad.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_allowed_copy_scope_to_aad.py index 8ef790ad73ad..19444d1f899e 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_allowed_copy_scope_to_aad.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_allowed_copy_scope_to_aad.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_allowed_copy_scope_to_private_link.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_allowed_copy_scope_to_private_link.py index 9513936e0903..08f90a1c6544 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_allowed_copy_scope_to_private_link.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_allowed_copy_scope_to_private_link.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_disallow_public_network_access.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_disallow_public_network_access.py index 30da22af8cc7..93639ce935c8 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_disallow_public_network_access.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_disallow_public_network_access.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_dns_endpoint_type_to_azure_dns_zone.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_dns_endpoint_type_to_azure_dns_zone.py index f6bd2c07ad4d..e38367dc440e 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_dns_endpoint_type_to_azure_dns_zone.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_dns_endpoint_type_to_azure_dns_zone.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_dns_endpoint_type_to_standard.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_dns_endpoint_type_to_standard.py index 58751957d828..3439488f08f8 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_dns_endpoint_type_to_standard.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_dns_endpoint_type_to_standard.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_enable_public_network_access.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_enable_public_network_access.py index 70b64f3ea3bd..d15dea0f97e8 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_enable_public_network_access.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_enable_public_network_access.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_object_replication_policy_on_destination.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_object_replication_policy_on_destination.py index 51d5767bd151..675777de93f3 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_object_replication_policy_on_destination.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_object_replication_policy_on_destination.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_object_replication_policy_on_source.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_object_replication_policy_on_source.py index 2eb549054fde..6ae93817bdb1 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_object_replication_policy_on_source.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_object_replication_policy_on_source.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_premium_block_blob_storage.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_premium_block_blob_storage.py index 0c680d6c770b..6c55ac3fe5a7 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_premium_block_blob_storage.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_premium_block_blob_storage.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_user_assigned_encryption_identity_with_cmk.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_user_assigned_encryption_identity_with_cmk.py index c453021b7c99..bd0304976cf7 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_user_assigned_encryption_identity_with_cmk.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_user_assigned_encryption_identity_with_cmk.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_user_assigned_identity_with_federated_identity_client_id.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_user_assigned_identity_with_federated_identity_client_id.py index 4876aa1aeab9..43455df9c321 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_user_assigned_identity_with_federated_identity_client_id.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_user_assigned_identity_with_federated_identity_client_id.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_with_immutability_policy.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_with_immutability_policy.py index 130ed2a64ea2..12bbc48cebc4 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_with_immutability_policy.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_create_with_immutability_policy.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_delete_blob_inventory_policy.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_delete_blob_inventory_policy.py index 2b077e9e86e0..be3e8b2a7e19 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_delete_blob_inventory_policy.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_delete_blob_inventory_policy.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_delete_management_policy.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_delete_management_policy.py index e306f1d46c44..a01776aa7558 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_delete_management_policy.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_delete_management_policy.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_enable_ad.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_enable_ad.py index 4bef5a6a1b5d..04417d9ba1b9 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_enable_ad.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_enable_ad.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_enable_cmk.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_enable_cmk.py index 514e37910926..57601d16323d 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_enable_cmk.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_enable_cmk.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_get_blob_inventory_policy.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_get_blob_inventory_policy.py index befb7d8d224a..c2c2c1b2bb85 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_get_blob_inventory_policy.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_get_blob_inventory_policy.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_get_management_policy.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_get_management_policy.py index ff04afa97bb8..0a15f9fa08db 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_get_management_policy.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_get_management_policy.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_get_migration_failed.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_get_migration_failed.py index 0d6c4b3c13ac..ba131de38952 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_get_migration_failed.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_get_migration_failed.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_get_migration_in_progress.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_get_migration_in_progress.py index 8ad6d7c2258e..b82d2cd15d14 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_get_migration_in_progress.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_get_migration_in_progress.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_list_account_sas.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_list_account_sas.py index 5a27f8a1101f..b338b076ae4b 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_list_account_sas.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_list_account_sas.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_list_service_sas.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_list_service_sas.py index 34485cb1f9d6..29c2ddcb394f 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_list_service_sas.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_list_service_sas.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_patch_encryption_scope.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_patch_encryption_scope.py index ede89f35a777..d5d8b9b52edf 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_patch_encryption_scope.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_patch_encryption_scope.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_post_migration.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_post_migration.py index b820eb5c2d49..9b2d1283518a 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_post_migration.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_post_migration.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_put_encryption_scope_with_infrastructure_encryption.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_put_encryption_scope_with_infrastructure_encryption.py index ef5a5a35c5ba..28f4204f2523 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_put_encryption_scope_with_infrastructure_encryption.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_put_encryption_scope_with_infrastructure_encryption.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_put_private_endpoint_connection.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_put_private_endpoint_connection.py index df5057db6530..1a72371f8866 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_put_private_endpoint_connection.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_put_private_endpoint_connection.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_regenerate_kerb_key.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_regenerate_kerb_key.py index b1816bc28c5e..92bc80813588 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_regenerate_kerb_key.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_regenerate_kerb_key.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_regenerate_key.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_regenerate_key.py index 0f374fcc8f70..bd5ada38af33 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_regenerate_key.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_regenerate_key.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_blob_inventory_policy.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_blob_inventory_policy.py index dd010a1365f5..689f0d2c61a9 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_blob_inventory_policy.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_blob_inventory_policy.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_blob_inventory_policy_include_delete_and_new_schema_for_hns_account.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_blob_inventory_policy_include_delete_and_new_schema_for_hns_account.py index d0fcfb0dc606..b9eff00f835f 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_blob_inventory_policy_include_delete_and_new_schema_for_hns_account.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_blob_inventory_policy_include_delete_and_new_schema_for_hns_account.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_blob_inventory_policy_include_delete_and_new_schema_for_non_hns_account.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_blob_inventory_policy_include_delete_and_new_schema_for_non_hns_account.py index 02ea31966ee7..3657faefcfe2 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_blob_inventory_policy_include_delete_and_new_schema_for_non_hns_account.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_blob_inventory_policy_include_delete_and_new_schema_for_non_hns_account.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy.py index 02a461617cb7..0b3141493719 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_base_blob_days_after_creation_actions.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_base_blob_days_after_creation_actions.py index 801436fa4c54..e15862b56b47 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_base_blob_days_after_creation_actions.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_base_blob_days_after_creation_actions.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_cold_tier_actions.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_cold_tier_actions.py index deca4f8f4a14..28726eb18d60 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_cold_tier_actions.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_cold_tier_actions.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_for_block_and_append_blobs.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_for_block_and_append_blobs.py index 06c066ca5611..26c5dd983561 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_for_block_and_append_blobs.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_for_block_and_append_blobs.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_hot_tier_actions.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_hot_tier_actions.py index 44e6bf17bbff..8e5e8b0ca450 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_hot_tier_actions.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_hot_tier_actions.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_last_access_time_based_blob_actions.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_last_access_time_based_blob_actions.py index 6b23f89588de..dd2f42004d72 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_last_access_time_based_blob_actions.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_last_access_time_based_blob_actions.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_last_tier_change_time_actions.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_last_tier_change_time_actions.py index d178b4fa366a..c31c7e4a3d2d 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_last_tier_change_time_actions.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_last_tier_change_time_actions.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_with_snapshot_and_version.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_with_snapshot_and_version.py index c290abc64604..836ef1da3eb8 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_with_snapshot_and_version.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_set_management_policy_with_snapshot_and_version.py @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update.py index 4ac7e096d66f..d1d71d1ea0bd 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_allowed_copy_scope_to_aad.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_allowed_copy_scope_to_aad.py index 6ed234279cfb..6e083894da43 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_allowed_copy_scope_to_aad.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_allowed_copy_scope_to_aad.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_disable_public_network_access.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_disable_public_network_access.py index ba13c9837c91..a1fbf1dc28d6 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_disable_public_network_access.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_disable_public_network_access.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_object_replication_policy_on_destination.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_object_replication_policy_on_destination.py index 8e50f8cde4c6..89fbdb7df61f 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_object_replication_policy_on_destination.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_object_replication_policy_on_destination.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_object_replication_policy_on_source.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_object_replication_policy_on_source.py index 3de4bcfaabb2..84dc93f9fe68 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_object_replication_policy_on_source.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_object_replication_policy_on_source.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_user_assigned_encryption_identity_with_cmk.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_user_assigned_encryption_identity_with_cmk.py index 7843fc224281..03d8e0bf9fee 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_user_assigned_encryption_identity_with_cmk.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_user_assigned_encryption_identity_with_cmk.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_user_assigned_identity_with_federated_identity_client_id.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_user_assigned_identity_with_federated_identity_client_id.py index 69422b514208..c5ed23287d5b 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_user_assigned_identity_with_federated_identity_client_id.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_user_assigned_identity_with_federated_identity_client_id.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_with_immutability_policy.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_with_immutability_policy.py index d7a40480b31a..762dc70c8097 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_with_immutability_policy.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_account_update_with_immutability_policy.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_task_assignments_crud/patch_storage_task_assignment.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_task_assignments_crud/patch_storage_task_assignment.py index 64f9965138c2..c5972a31222d 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_task_assignments_crud/patch_storage_task_assignment.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_task_assignments_crud/patch_storage_task_assignment.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_task_assignments_crud/put_storage_task_assignment.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_task_assignments_crud/put_storage_task_assignment.py index 44524c64b5f2..c855d0564a03 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_task_assignments_crud/put_storage_task_assignment.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_task_assignments_crud/put_storage_task_assignment.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/storage_task_assignments_crud/put_storage_task_assignment_required_properties.py b/sdk/storage/azure-mgmt-storage/generated_samples/storage_task_assignments_crud/put_storage_task_assignment_required_properties.py index f687d4872a77..70f1a6e58584 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/storage_task_assignments_crud/put_storage_task_assignment_required_properties.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/storage_task_assignments_crud/put_storage_task_assignment_required_properties.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/table_operation_put_or_patch_acls.py b/sdk/storage/azure-mgmt-storage/generated_samples/table_operation_put_or_patch_acls.py index d842ace68060..034b75e8530b 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/table_operation_put_or_patch_acls.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/table_operation_put_or_patch_acls.py @@ -30,7 +30,7 @@ def main(): subscription_id="{subscription-id}", ) - response = client.table.create( + response = client.table.update( resource_group_name="res3376", account_name="sto328", table_name="table6185", diff --git a/sdk/storage/azure-mgmt-storage/generated_samples/table_services_put.py b/sdk/storage/azure-mgmt-storage/generated_samples/table_services_put.py index 86604df737ad..2c9779137b51 100644 --- a/sdk/storage/azure-mgmt-storage/generated_samples/table_services_put.py +++ b/sdk/storage/azure-mgmt-storage/generated_samples/table_services_put.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.storage import StorageManagementClient diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/conftest.py b/sdk/storage/azure-mgmt-storage/generated_tests/conftest.py new file mode 100644 index 000000000000..167edda55fba --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/conftest.py @@ -0,0 +1,35 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# For security, please avoid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + storagemanagement_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + storagemanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + storagemanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + storagemanagement_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=storagemanagement_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=storagemanagement_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=storagemanagement_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=storagemanagement_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_blob_containers_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_blob_containers_operations.py new file mode 100644 index 000000000000..e2a1ff10ee3f --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_blob_containers_operations.py @@ -0,0 +1,332 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementBlobContainersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_blob_containers_list(self, resource_group): + response = self.client.blob_containers.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_blob_containers_create(self, resource_group): + response = self.client.blob_containers.create( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + blob_container={ + "defaultEncryptionScope": "str", + "deleted": bool, + "deletedTime": "2020-02-20 00:00:00", + "denyEncryptionScopeOverride": bool, + "enableNfsV3AllSquash": bool, + "enableNfsV3RootSquash": bool, + "etag": "str", + "hasImmutabilityPolicy": bool, + "hasLegalHold": bool, + "id": "str", + "immutabilityPolicy": { + "allowProtectedAppendWrites": bool, + "allowProtectedAppendWritesAll": bool, + "etag": "str", + "immutabilityPeriodSinceCreationInDays": 0, + "state": "str", + "updateHistory": [ + { + "allowProtectedAppendWrites": bool, + "allowProtectedAppendWritesAll": bool, + "immutabilityPeriodSinceCreationInDays": 0, + "objectIdentifier": "str", + "tenantId": "str", + "timestamp": "2020-02-20 00:00:00", + "update": "str", + "upn": "str", + } + ], + }, + "immutableStorageWithVersioning": { + "enabled": bool, + "migrationState": "str", + "timeStamp": "2020-02-20 00:00:00", + }, + "lastModifiedTime": "2020-02-20 00:00:00", + "leaseDuration": "str", + "leaseState": "str", + "leaseStatus": "str", + "legalHold": { + "hasLegalHold": bool, + "protectedAppendWritesHistory": { + "allowProtectedAppendWritesAll": bool, + "timestamp": "2020-02-20 00:00:00", + }, + "tags": [ + { + "objectIdentifier": "str", + "tag": "str", + "tenantId": "str", + "timestamp": "2020-02-20 00:00:00", + "upn": "str", + } + ], + }, + "metadata": {"str": "str"}, + "name": "str", + "publicAccess": "str", + "remainingRetentionDays": 0, + "type": "str", + "version": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_blob_containers_update(self, resource_group): + response = self.client.blob_containers.update( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + blob_container={ + "defaultEncryptionScope": "str", + "deleted": bool, + "deletedTime": "2020-02-20 00:00:00", + "denyEncryptionScopeOverride": bool, + "enableNfsV3AllSquash": bool, + "enableNfsV3RootSquash": bool, + "etag": "str", + "hasImmutabilityPolicy": bool, + "hasLegalHold": bool, + "id": "str", + "immutabilityPolicy": { + "allowProtectedAppendWrites": bool, + "allowProtectedAppendWritesAll": bool, + "etag": "str", + "immutabilityPeriodSinceCreationInDays": 0, + "state": "str", + "updateHistory": [ + { + "allowProtectedAppendWrites": bool, + "allowProtectedAppendWritesAll": bool, + "immutabilityPeriodSinceCreationInDays": 0, + "objectIdentifier": "str", + "tenantId": "str", + "timestamp": "2020-02-20 00:00:00", + "update": "str", + "upn": "str", + } + ], + }, + "immutableStorageWithVersioning": { + "enabled": bool, + "migrationState": "str", + "timeStamp": "2020-02-20 00:00:00", + }, + "lastModifiedTime": "2020-02-20 00:00:00", + "leaseDuration": "str", + "leaseState": "str", + "leaseStatus": "str", + "legalHold": { + "hasLegalHold": bool, + "protectedAppendWritesHistory": { + "allowProtectedAppendWritesAll": bool, + "timestamp": "2020-02-20 00:00:00", + }, + "tags": [ + { + "objectIdentifier": "str", + "tag": "str", + "tenantId": "str", + "timestamp": "2020-02-20 00:00:00", + "upn": "str", + } + ], + }, + "metadata": {"str": "str"}, + "name": "str", + "publicAccess": "str", + "remainingRetentionDays": 0, + "type": "str", + "version": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_blob_containers_get(self, resource_group): + response = self.client.blob_containers.get( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_blob_containers_delete(self, resource_group): + response = self.client.blob_containers.delete( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_blob_containers_set_legal_hold(self, resource_group): + response = self.client.blob_containers.set_legal_hold( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + legal_hold={"tags": ["str"], "allowProtectedAppendWritesAll": bool, "hasLegalHold": bool}, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_blob_containers_clear_legal_hold(self, resource_group): + response = self.client.blob_containers.clear_legal_hold( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + legal_hold={"tags": ["str"], "allowProtectedAppendWritesAll": bool, "hasLegalHold": bool}, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_blob_containers_create_or_update_immutability_policy(self, resource_group): + response = self.client.blob_containers.create_or_update_immutability_policy( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + immutability_policy_name="default", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_blob_containers_get_immutability_policy(self, resource_group): + response = self.client.blob_containers.get_immutability_policy( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + immutability_policy_name="default", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_blob_containers_delete_immutability_policy(self, resource_group): + response = self.client.blob_containers.delete_immutability_policy( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + if_match="str", + immutability_policy_name="default", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_blob_containers_lock_immutability_policy(self, resource_group): + response = self.client.blob_containers.lock_immutability_policy( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + if_match="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_blob_containers_extend_immutability_policy(self, resource_group): + response = self.client.blob_containers.extend_immutability_policy( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + if_match="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_blob_containers_lease(self, resource_group): + response = self.client.blob_containers.lease( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_blob_containers_begin_object_level_worm(self, resource_group): + response = self.client.blob_containers.begin_object_level_worm( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + api_version="2023-05-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_blob_containers_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_blob_containers_operations_async.py new file mode 100644 index 000000000000..779d53890a1c --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_blob_containers_operations_async.py @@ -0,0 +1,335 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementBlobContainersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_blob_containers_list(self, resource_group): + response = self.client.blob_containers.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_blob_containers_create(self, resource_group): + response = await self.client.blob_containers.create( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + blob_container={ + "defaultEncryptionScope": "str", + "deleted": bool, + "deletedTime": "2020-02-20 00:00:00", + "denyEncryptionScopeOverride": bool, + "enableNfsV3AllSquash": bool, + "enableNfsV3RootSquash": bool, + "etag": "str", + "hasImmutabilityPolicy": bool, + "hasLegalHold": bool, + "id": "str", + "immutabilityPolicy": { + "allowProtectedAppendWrites": bool, + "allowProtectedAppendWritesAll": bool, + "etag": "str", + "immutabilityPeriodSinceCreationInDays": 0, + "state": "str", + "updateHistory": [ + { + "allowProtectedAppendWrites": bool, + "allowProtectedAppendWritesAll": bool, + "immutabilityPeriodSinceCreationInDays": 0, + "objectIdentifier": "str", + "tenantId": "str", + "timestamp": "2020-02-20 00:00:00", + "update": "str", + "upn": "str", + } + ], + }, + "immutableStorageWithVersioning": { + "enabled": bool, + "migrationState": "str", + "timeStamp": "2020-02-20 00:00:00", + }, + "lastModifiedTime": "2020-02-20 00:00:00", + "leaseDuration": "str", + "leaseState": "str", + "leaseStatus": "str", + "legalHold": { + "hasLegalHold": bool, + "protectedAppendWritesHistory": { + "allowProtectedAppendWritesAll": bool, + "timestamp": "2020-02-20 00:00:00", + }, + "tags": [ + { + "objectIdentifier": "str", + "tag": "str", + "tenantId": "str", + "timestamp": "2020-02-20 00:00:00", + "upn": "str", + } + ], + }, + "metadata": {"str": "str"}, + "name": "str", + "publicAccess": "str", + "remainingRetentionDays": 0, + "type": "str", + "version": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_blob_containers_update(self, resource_group): + response = await self.client.blob_containers.update( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + blob_container={ + "defaultEncryptionScope": "str", + "deleted": bool, + "deletedTime": "2020-02-20 00:00:00", + "denyEncryptionScopeOverride": bool, + "enableNfsV3AllSquash": bool, + "enableNfsV3RootSquash": bool, + "etag": "str", + "hasImmutabilityPolicy": bool, + "hasLegalHold": bool, + "id": "str", + "immutabilityPolicy": { + "allowProtectedAppendWrites": bool, + "allowProtectedAppendWritesAll": bool, + "etag": "str", + "immutabilityPeriodSinceCreationInDays": 0, + "state": "str", + "updateHistory": [ + { + "allowProtectedAppendWrites": bool, + "allowProtectedAppendWritesAll": bool, + "immutabilityPeriodSinceCreationInDays": 0, + "objectIdentifier": "str", + "tenantId": "str", + "timestamp": "2020-02-20 00:00:00", + "update": "str", + "upn": "str", + } + ], + }, + "immutableStorageWithVersioning": { + "enabled": bool, + "migrationState": "str", + "timeStamp": "2020-02-20 00:00:00", + }, + "lastModifiedTime": "2020-02-20 00:00:00", + "leaseDuration": "str", + "leaseState": "str", + "leaseStatus": "str", + "legalHold": { + "hasLegalHold": bool, + "protectedAppendWritesHistory": { + "allowProtectedAppendWritesAll": bool, + "timestamp": "2020-02-20 00:00:00", + }, + "tags": [ + { + "objectIdentifier": "str", + "tag": "str", + "tenantId": "str", + "timestamp": "2020-02-20 00:00:00", + "upn": "str", + } + ], + }, + "metadata": {"str": "str"}, + "name": "str", + "publicAccess": "str", + "remainingRetentionDays": 0, + "type": "str", + "version": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_blob_containers_get(self, resource_group): + response = await self.client.blob_containers.get( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_blob_containers_delete(self, resource_group): + response = await self.client.blob_containers.delete( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_blob_containers_set_legal_hold(self, resource_group): + response = await self.client.blob_containers.set_legal_hold( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + legal_hold={"tags": ["str"], "allowProtectedAppendWritesAll": bool, "hasLegalHold": bool}, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_blob_containers_clear_legal_hold(self, resource_group): + response = await self.client.blob_containers.clear_legal_hold( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + legal_hold={"tags": ["str"], "allowProtectedAppendWritesAll": bool, "hasLegalHold": bool}, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_blob_containers_create_or_update_immutability_policy(self, resource_group): + response = await self.client.blob_containers.create_or_update_immutability_policy( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + immutability_policy_name="default", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_blob_containers_get_immutability_policy(self, resource_group): + response = await self.client.blob_containers.get_immutability_policy( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + immutability_policy_name="default", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_blob_containers_delete_immutability_policy(self, resource_group): + response = await self.client.blob_containers.delete_immutability_policy( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + if_match="str", + immutability_policy_name="default", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_blob_containers_lock_immutability_policy(self, resource_group): + response = await self.client.blob_containers.lock_immutability_policy( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + if_match="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_blob_containers_extend_immutability_policy(self, resource_group): + response = await self.client.blob_containers.extend_immutability_policy( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + if_match="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_blob_containers_lease(self, resource_group): + response = await self.client.blob_containers.lease( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_blob_containers_begin_object_level_worm(self, resource_group): + response = await ( + await self.client.blob_containers.begin_object_level_worm( + resource_group_name=resource_group.name, + account_name="str", + container_name="str", + api_version="2023-05-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_blob_inventory_policies_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_blob_inventory_policies_operations.py new file mode 100644 index 000000000000..1a59501b100e --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_blob_inventory_policies_operations.py @@ -0,0 +1,111 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementBlobInventoryPoliciesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_blob_inventory_policies_get(self, resource_group): + response = self.client.blob_inventory_policies.get( + resource_group_name=resource_group.name, + account_name="str", + blob_inventory_policy_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_blob_inventory_policies_create_or_update(self, resource_group): + response = self.client.blob_inventory_policies.create_or_update( + resource_group_name=resource_group.name, + account_name="str", + blob_inventory_policy_name="str", + properties={ + "id": "str", + "lastModifiedTime": "2020-02-20 00:00:00", + "name": "str", + "policy": { + "enabled": bool, + "rules": [ + { + "definition": { + "format": "str", + "objectType": "str", + "schedule": "str", + "schemaFields": ["str"], + "filters": { + "blobTypes": ["str"], + "creationTime": {"lastNDays": 0}, + "excludePrefix": ["str"], + "includeBlobVersions": bool, + "includeDeleted": bool, + "includeSnapshots": bool, + "prefixMatch": ["str"], + }, + }, + "destination": "str", + "enabled": bool, + "name": "str", + } + ], + "type": "str", + "destination": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_blob_inventory_policies_delete(self, resource_group): + response = self.client.blob_inventory_policies.delete( + resource_group_name=resource_group.name, + account_name="str", + blob_inventory_policy_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_blob_inventory_policies_list(self, resource_group): + response = self.client.blob_inventory_policies.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_blob_inventory_policies_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_blob_inventory_policies_operations_async.py new file mode 100644 index 000000000000..6894bb0f21ed --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_blob_inventory_policies_operations_async.py @@ -0,0 +1,112 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementBlobInventoryPoliciesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_blob_inventory_policies_get(self, resource_group): + response = await self.client.blob_inventory_policies.get( + resource_group_name=resource_group.name, + account_name="str", + blob_inventory_policy_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_blob_inventory_policies_create_or_update(self, resource_group): + response = await self.client.blob_inventory_policies.create_or_update( + resource_group_name=resource_group.name, + account_name="str", + blob_inventory_policy_name="str", + properties={ + "id": "str", + "lastModifiedTime": "2020-02-20 00:00:00", + "name": "str", + "policy": { + "enabled": bool, + "rules": [ + { + "definition": { + "format": "str", + "objectType": "str", + "schedule": "str", + "schemaFields": ["str"], + "filters": { + "blobTypes": ["str"], + "creationTime": {"lastNDays": 0}, + "excludePrefix": ["str"], + "includeBlobVersions": bool, + "includeDeleted": bool, + "includeSnapshots": bool, + "prefixMatch": ["str"], + }, + }, + "destination": "str", + "enabled": bool, + "name": "str", + } + ], + "type": "str", + "destination": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_blob_inventory_policies_delete(self, resource_group): + response = await self.client.blob_inventory_policies.delete( + resource_group_name=resource_group.name, + account_name="str", + blob_inventory_policy_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_blob_inventory_policies_list(self, resource_group): + response = self.client.blob_inventory_policies.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_blob_services_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_blob_services_operations.py new file mode 100644 index 000000000000..01037888d872 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_blob_services_operations.py @@ -0,0 +1,92 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementBlobServicesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_blob_services_list(self, resource_group): + response = self.client.blob_services.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_blob_services_set_service_properties(self, resource_group): + response = self.client.blob_services.set_service_properties( + resource_group_name=resource_group.name, + account_name="str", + parameters={ + "automaticSnapshotPolicyEnabled": bool, + "changeFeed": {"enabled": bool, "retentionInDays": 0}, + "containerDeleteRetentionPolicy": {"allowPermanentDelete": bool, "days": 0, "enabled": bool}, + "cors": { + "corsRules": [ + { + "allowedHeaders": ["str"], + "allowedMethods": ["str"], + "allowedOrigins": ["str"], + "exposedHeaders": ["str"], + "maxAgeInSeconds": 0, + } + ] + }, + "defaultServiceVersion": "str", + "deleteRetentionPolicy": {"allowPermanentDelete": bool, "days": 0, "enabled": bool}, + "id": "str", + "isVersioningEnabled": bool, + "lastAccessTimeTrackingPolicy": { + "enable": bool, + "blobType": ["str"], + "name": "str", + "trackingGranularityInDays": 0, + }, + "name": "str", + "restorePolicy": { + "enabled": bool, + "days": 0, + "lastEnabledTime": "2020-02-20 00:00:00", + "minRestoreTime": "2020-02-20 00:00:00", + }, + "sku": {"name": "str", "tier": "str"}, + "type": "str", + }, + api_version="2023-05-01", + blob_services_name="default", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_blob_services_get_service_properties(self, resource_group): + response = self.client.blob_services.get_service_properties( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + blob_services_name="default", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_blob_services_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_blob_services_operations_async.py new file mode 100644 index 000000000000..7dcb3dcb783e --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_blob_services_operations_async.py @@ -0,0 +1,93 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementBlobServicesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_blob_services_list(self, resource_group): + response = self.client.blob_services.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_blob_services_set_service_properties(self, resource_group): + response = await self.client.blob_services.set_service_properties( + resource_group_name=resource_group.name, + account_name="str", + parameters={ + "automaticSnapshotPolicyEnabled": bool, + "changeFeed": {"enabled": bool, "retentionInDays": 0}, + "containerDeleteRetentionPolicy": {"allowPermanentDelete": bool, "days": 0, "enabled": bool}, + "cors": { + "corsRules": [ + { + "allowedHeaders": ["str"], + "allowedMethods": ["str"], + "allowedOrigins": ["str"], + "exposedHeaders": ["str"], + "maxAgeInSeconds": 0, + } + ] + }, + "defaultServiceVersion": "str", + "deleteRetentionPolicy": {"allowPermanentDelete": bool, "days": 0, "enabled": bool}, + "id": "str", + "isVersioningEnabled": bool, + "lastAccessTimeTrackingPolicy": { + "enable": bool, + "blobType": ["str"], + "name": "str", + "trackingGranularityInDays": 0, + }, + "name": "str", + "restorePolicy": { + "enabled": bool, + "days": 0, + "lastEnabledTime": "2020-02-20 00:00:00", + "minRestoreTime": "2020-02-20 00:00:00", + }, + "sku": {"name": "str", "tier": "str"}, + "type": "str", + }, + api_version="2023-05-01", + blob_services_name="default", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_blob_services_get_service_properties(self, resource_group): + response = await self.client.blob_services.get_service_properties( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + blob_services_name="default", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_deleted_accounts_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_deleted_accounts_operations.py new file mode 100644 index 000000000000..0c93601d263f --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_deleted_accounts_operations.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementDeletedAccountsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_deleted_accounts_list(self, resource_group): + response = self.client.deleted_accounts.list( + api_version="2023-05-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_deleted_accounts_get(self, resource_group): + response = self.client.deleted_accounts.get( + deleted_account_name="str", + location="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_deleted_accounts_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_deleted_accounts_operations_async.py new file mode 100644 index 000000000000..51438764de64 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_deleted_accounts_operations_async.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementDeletedAccountsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_deleted_accounts_list(self, resource_group): + response = self.client.deleted_accounts.list( + api_version="2023-05-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_deleted_accounts_get(self, resource_group): + response = await self.client.deleted_accounts.get( + deleted_account_name="str", + location="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_encryption_scopes_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_encryption_scopes_operations.py new file mode 100644 index 000000000000..9666c4662b16 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_encryption_scopes_operations.py @@ -0,0 +1,100 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementEncryptionScopesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_encryption_scopes_put(self, resource_group): + response = self.client.encryption_scopes.put( + resource_group_name=resource_group.name, + account_name="str", + encryption_scope_name="str", + encryption_scope={ + "creationTime": "2020-02-20 00:00:00", + "id": "str", + "keyVaultProperties": { + "currentVersionedKeyIdentifier": "str", + "keyUri": "str", + "lastKeyRotationTimestamp": "2020-02-20 00:00:00", + }, + "lastModifiedTime": "2020-02-20 00:00:00", + "name": "str", + "requireInfrastructureEncryption": bool, + "source": "str", + "state": "str", + "type": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_encryption_scopes_patch(self, resource_group): + response = self.client.encryption_scopes.patch( + resource_group_name=resource_group.name, + account_name="str", + encryption_scope_name="str", + encryption_scope={ + "creationTime": "2020-02-20 00:00:00", + "id": "str", + "keyVaultProperties": { + "currentVersionedKeyIdentifier": "str", + "keyUri": "str", + "lastKeyRotationTimestamp": "2020-02-20 00:00:00", + }, + "lastModifiedTime": "2020-02-20 00:00:00", + "name": "str", + "requireInfrastructureEncryption": bool, + "source": "str", + "state": "str", + "type": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_encryption_scopes_get(self, resource_group): + response = self.client.encryption_scopes.get( + resource_group_name=resource_group.name, + account_name="str", + encryption_scope_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_encryption_scopes_list(self, resource_group): + response = self.client.encryption_scopes.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_encryption_scopes_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_encryption_scopes_operations_async.py new file mode 100644 index 000000000000..fdd1a7cb993b --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_encryption_scopes_operations_async.py @@ -0,0 +1,101 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementEncryptionScopesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_encryption_scopes_put(self, resource_group): + response = await self.client.encryption_scopes.put( + resource_group_name=resource_group.name, + account_name="str", + encryption_scope_name="str", + encryption_scope={ + "creationTime": "2020-02-20 00:00:00", + "id": "str", + "keyVaultProperties": { + "currentVersionedKeyIdentifier": "str", + "keyUri": "str", + "lastKeyRotationTimestamp": "2020-02-20 00:00:00", + }, + "lastModifiedTime": "2020-02-20 00:00:00", + "name": "str", + "requireInfrastructureEncryption": bool, + "source": "str", + "state": "str", + "type": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_encryption_scopes_patch(self, resource_group): + response = await self.client.encryption_scopes.patch( + resource_group_name=resource_group.name, + account_name="str", + encryption_scope_name="str", + encryption_scope={ + "creationTime": "2020-02-20 00:00:00", + "id": "str", + "keyVaultProperties": { + "currentVersionedKeyIdentifier": "str", + "keyUri": "str", + "lastKeyRotationTimestamp": "2020-02-20 00:00:00", + }, + "lastModifiedTime": "2020-02-20 00:00:00", + "name": "str", + "requireInfrastructureEncryption": bool, + "source": "str", + "state": "str", + "type": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_encryption_scopes_get(self, resource_group): + response = await self.client.encryption_scopes.get( + resource_group_name=resource_group.name, + account_name="str", + encryption_scope_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_encryption_scopes_list(self, resource_group): + response = self.client.encryption_scopes.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_file_services_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_file_services_operations.py new file mode 100644 index 000000000000..31c6fd576c33 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_file_services_operations.py @@ -0,0 +1,84 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementFileServicesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_file_services_list(self, resource_group): + response = self.client.file_services.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_file_services_set_service_properties(self, resource_group): + response = self.client.file_services.set_service_properties( + resource_group_name=resource_group.name, + account_name="str", + parameters={ + "cors": { + "corsRules": [ + { + "allowedHeaders": ["str"], + "allowedMethods": ["str"], + "allowedOrigins": ["str"], + "exposedHeaders": ["str"], + "maxAgeInSeconds": 0, + } + ] + }, + "id": "str", + "name": "str", + "protocolSettings": { + "smb": { + "authenticationMethods": "str", + "channelEncryption": "str", + "kerberosTicketEncryption": "str", + "multichannel": {"enabled": bool}, + "versions": "str", + } + }, + "shareDeleteRetentionPolicy": {"allowPermanentDelete": bool, "days": 0, "enabled": bool}, + "sku": {"name": "str", "tier": "str"}, + "type": "str", + }, + api_version="2023-05-01", + file_services_name="default", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_file_services_get_service_properties(self, resource_group): + response = self.client.file_services.get_service_properties( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + file_services_name="default", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_file_services_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_file_services_operations_async.py new file mode 100644 index 000000000000..59390ce86770 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_file_services_operations_async.py @@ -0,0 +1,85 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementFileServicesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_file_services_list(self, resource_group): + response = await self.client.file_services.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_file_services_set_service_properties(self, resource_group): + response = await self.client.file_services.set_service_properties( + resource_group_name=resource_group.name, + account_name="str", + parameters={ + "cors": { + "corsRules": [ + { + "allowedHeaders": ["str"], + "allowedMethods": ["str"], + "allowedOrigins": ["str"], + "exposedHeaders": ["str"], + "maxAgeInSeconds": 0, + } + ] + }, + "id": "str", + "name": "str", + "protocolSettings": { + "smb": { + "authenticationMethods": "str", + "channelEncryption": "str", + "kerberosTicketEncryption": "str", + "multichannel": {"enabled": bool}, + "versions": "str", + } + }, + "shareDeleteRetentionPolicy": {"allowPermanentDelete": bool, "days": 0, "enabled": bool}, + "sku": {"name": "str", "tier": "str"}, + "type": "str", + }, + api_version="2023-05-01", + file_services_name="default", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_file_services_get_service_properties(self, resource_group): + response = await self.client.file_services.get_service_properties( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + file_services_name="default", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_file_shares_operations.py new file mode 100644 index 000000000000..95c9db02ae33 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_file_shares_operations.py @@ -0,0 +1,176 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementFileSharesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_file_shares_list(self, resource_group): + response = self.client.file_shares.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_file_shares_create(self, resource_group): + response = self.client.file_shares.create( + resource_group_name=resource_group.name, + account_name="str", + share_name="str", + file_share={ + "accessTier": "str", + "accessTierChangeTime": "2020-02-20 00:00:00", + "accessTierStatus": "str", + "deleted": bool, + "deletedTime": "2020-02-20 00:00:00", + "enabledProtocols": "str", + "etag": "str", + "id": "str", + "lastModifiedTime": "2020-02-20 00:00:00", + "leaseDuration": "str", + "leaseState": "str", + "leaseStatus": "str", + "metadata": {"str": "str"}, + "name": "str", + "remainingRetentionDays": 0, + "rootSquash": "str", + "shareQuota": 0, + "shareUsageBytes": 0, + "signedIdentifiers": [ + { + "accessPolicy": { + "expiryTime": "2020-02-20 00:00:00", + "permission": "str", + "startTime": "2020-02-20 00:00:00", + }, + "id": "str", + } + ], + "snapshotTime": "2020-02-20 00:00:00", + "type": "str", + "version": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_file_shares_update(self, resource_group): + response = self.client.file_shares.update( + resource_group_name=resource_group.name, + account_name="str", + share_name="str", + file_share={ + "accessTier": "str", + "accessTierChangeTime": "2020-02-20 00:00:00", + "accessTierStatus": "str", + "deleted": bool, + "deletedTime": "2020-02-20 00:00:00", + "enabledProtocols": "str", + "etag": "str", + "id": "str", + "lastModifiedTime": "2020-02-20 00:00:00", + "leaseDuration": "str", + "leaseState": "str", + "leaseStatus": "str", + "metadata": {"str": "str"}, + "name": "str", + "remainingRetentionDays": 0, + "rootSquash": "str", + "shareQuota": 0, + "shareUsageBytes": 0, + "signedIdentifiers": [ + { + "accessPolicy": { + "expiryTime": "2020-02-20 00:00:00", + "permission": "str", + "startTime": "2020-02-20 00:00:00", + }, + "id": "str", + } + ], + "snapshotTime": "2020-02-20 00:00:00", + "type": "str", + "version": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_file_shares_get(self, resource_group): + response = self.client.file_shares.get( + resource_group_name=resource_group.name, + account_name="str", + share_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_file_shares_delete(self, resource_group): + response = self.client.file_shares.delete( + resource_group_name=resource_group.name, + account_name="str", + share_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_file_shares_restore(self, resource_group): + response = self.client.file_shares.restore( + resource_group_name=resource_group.name, + account_name="str", + share_name="str", + deleted_share={"deletedShareName": "str", "deletedShareVersion": "str"}, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_file_shares_lease(self, resource_group): + response = self.client.file_shares.lease( + resource_group_name=resource_group.name, + account_name="str", + share_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_file_shares_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_file_shares_operations_async.py new file mode 100644 index 000000000000..d99e15231a85 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_file_shares_operations_async.py @@ -0,0 +1,177 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementFileSharesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_file_shares_list(self, resource_group): + response = self.client.file_shares.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_file_shares_create(self, resource_group): + response = await self.client.file_shares.create( + resource_group_name=resource_group.name, + account_name="str", + share_name="str", + file_share={ + "accessTier": "str", + "accessTierChangeTime": "2020-02-20 00:00:00", + "accessTierStatus": "str", + "deleted": bool, + "deletedTime": "2020-02-20 00:00:00", + "enabledProtocols": "str", + "etag": "str", + "id": "str", + "lastModifiedTime": "2020-02-20 00:00:00", + "leaseDuration": "str", + "leaseState": "str", + "leaseStatus": "str", + "metadata": {"str": "str"}, + "name": "str", + "remainingRetentionDays": 0, + "rootSquash": "str", + "shareQuota": 0, + "shareUsageBytes": 0, + "signedIdentifiers": [ + { + "accessPolicy": { + "expiryTime": "2020-02-20 00:00:00", + "permission": "str", + "startTime": "2020-02-20 00:00:00", + }, + "id": "str", + } + ], + "snapshotTime": "2020-02-20 00:00:00", + "type": "str", + "version": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_file_shares_update(self, resource_group): + response = await self.client.file_shares.update( + resource_group_name=resource_group.name, + account_name="str", + share_name="str", + file_share={ + "accessTier": "str", + "accessTierChangeTime": "2020-02-20 00:00:00", + "accessTierStatus": "str", + "deleted": bool, + "deletedTime": "2020-02-20 00:00:00", + "enabledProtocols": "str", + "etag": "str", + "id": "str", + "lastModifiedTime": "2020-02-20 00:00:00", + "leaseDuration": "str", + "leaseState": "str", + "leaseStatus": "str", + "metadata": {"str": "str"}, + "name": "str", + "remainingRetentionDays": 0, + "rootSquash": "str", + "shareQuota": 0, + "shareUsageBytes": 0, + "signedIdentifiers": [ + { + "accessPolicy": { + "expiryTime": "2020-02-20 00:00:00", + "permission": "str", + "startTime": "2020-02-20 00:00:00", + }, + "id": "str", + } + ], + "snapshotTime": "2020-02-20 00:00:00", + "type": "str", + "version": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_file_shares_get(self, resource_group): + response = await self.client.file_shares.get( + resource_group_name=resource_group.name, + account_name="str", + share_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_file_shares_delete(self, resource_group): + response = await self.client.file_shares.delete( + resource_group_name=resource_group.name, + account_name="str", + share_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_file_shares_restore(self, resource_group): + response = await self.client.file_shares.restore( + resource_group_name=resource_group.name, + account_name="str", + share_name="str", + deleted_share={"deletedShareName": "str", "deletedShareVersion": "str"}, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_file_shares_lease(self, resource_group): + response = await self.client.file_shares.lease( + resource_group_name=resource_group.name, + account_name="str", + share_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_local_users_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_local_users_operations.py new file mode 100644 index 000000000000..acd69b4046e2 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_local_users_operations.py @@ -0,0 +1,121 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementLocalUsersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_users_list(self, resource_group): + response = self.client.local_users.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_users_get(self, resource_group): + response = self.client.local_users.get( + resource_group_name=resource_group.name, + account_name="str", + username="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_users_create_or_update(self, resource_group): + response = self.client.local_users.create_or_update( + resource_group_name=resource_group.name, + account_name="str", + username="str", + properties={ + "allowAclAuthorization": bool, + "extendedGroups": [0], + "groupId": 0, + "hasSharedKey": bool, + "hasSshKey": bool, + "hasSshPassword": bool, + "homeDirectory": "str", + "id": "str", + "isNFSv3Enabled": bool, + "name": "str", + "permissionScopes": [{"permissions": "str", "resourceName": "str", "service": "str"}], + "sid": "str", + "sshAuthorizedKeys": [{"description": "str", "key": "str"}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + "userId": 0, + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_users_delete(self, resource_group): + response = self.client.local_users.delete( + resource_group_name=resource_group.name, + account_name="str", + username="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_users_list_keys(self, resource_group): + response = self.client.local_users.list_keys( + resource_group_name=resource_group.name, + account_name="str", + username="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_local_users_regenerate_password(self, resource_group): + response = self.client.local_users.regenerate_password( + resource_group_name=resource_group.name, + account_name="str", + username="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_local_users_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_local_users_operations_async.py new file mode 100644 index 000000000000..25ef0d4d499e --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_local_users_operations_async.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementLocalUsersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_users_list(self, resource_group): + response = self.client.local_users.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_users_get(self, resource_group): + response = await self.client.local_users.get( + resource_group_name=resource_group.name, + account_name="str", + username="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_users_create_or_update(self, resource_group): + response = await self.client.local_users.create_or_update( + resource_group_name=resource_group.name, + account_name="str", + username="str", + properties={ + "allowAclAuthorization": bool, + "extendedGroups": [0], + "groupId": 0, + "hasSharedKey": bool, + "hasSshKey": bool, + "hasSshPassword": bool, + "homeDirectory": "str", + "id": "str", + "isNFSv3Enabled": bool, + "name": "str", + "permissionScopes": [{"permissions": "str", "resourceName": "str", "service": "str"}], + "sid": "str", + "sshAuthorizedKeys": [{"description": "str", "key": "str"}], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + "userId": 0, + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_users_delete(self, resource_group): + response = await self.client.local_users.delete( + resource_group_name=resource_group.name, + account_name="str", + username="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_users_list_keys(self, resource_group): + response = await self.client.local_users.list_keys( + resource_group_name=resource_group.name, + account_name="str", + username="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_local_users_regenerate_password(self, resource_group): + response = await self.client.local_users.regenerate_password( + resource_group_name=resource_group.name, + account_name="str", + username="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_management_policies_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_management_policies_operations.py new file mode 100644 index 000000000000..37d954e5df67 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_management_policies_operations.py @@ -0,0 +1,159 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementManagementPoliciesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_management_policies_get(self, resource_group): + response = self.client.management_policies.get( + resource_group_name=resource_group.name, + account_name="str", + management_policy_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_management_policies_create_or_update(self, resource_group): + response = self.client.management_policies.create_or_update( + resource_group_name=resource_group.name, + account_name="str", + management_policy_name="str", + properties={ + "id": "str", + "lastModifiedTime": "2020-02-20 00:00:00", + "name": "str", + "policy": { + "rules": [ + { + "definition": { + "actions": { + "baseBlob": { + "delete": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastAccessTimeGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + "daysAfterModificationGreaterThan": 0.0, + }, + "enableAutoTierToHotFromCool": bool, + "tierToArchive": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastAccessTimeGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + "daysAfterModificationGreaterThan": 0.0, + }, + "tierToCold": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastAccessTimeGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + "daysAfterModificationGreaterThan": 0.0, + }, + "tierToCool": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastAccessTimeGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + "daysAfterModificationGreaterThan": 0.0, + }, + "tierToHot": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastAccessTimeGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + "daysAfterModificationGreaterThan": 0.0, + }, + }, + "snapshot": { + "delete": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + }, + "tierToArchive": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + }, + "tierToCold": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + }, + "tierToCool": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + }, + "tierToHot": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + }, + }, + "version": { + "delete": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + }, + "tierToArchive": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + }, + "tierToCold": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + }, + "tierToCool": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + }, + "tierToHot": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + }, + }, + }, + "filters": { + "blobTypes": ["str"], + "blobIndexMatch": [{"name": "str", "op": "str", "value": "str"}], + "prefixMatch": ["str"], + }, + }, + "name": "str", + "type": "str", + "enabled": bool, + } + ] + }, + "type": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_management_policies_delete(self, resource_group): + response = self.client.management_policies.delete( + resource_group_name=resource_group.name, + account_name="str", + management_policy_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_management_policies_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_management_policies_operations_async.py new file mode 100644 index 000000000000..ea96be653e80 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_management_policies_operations_async.py @@ -0,0 +1,160 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementManagementPoliciesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_management_policies_get(self, resource_group): + response = await self.client.management_policies.get( + resource_group_name=resource_group.name, + account_name="str", + management_policy_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_management_policies_create_or_update(self, resource_group): + response = await self.client.management_policies.create_or_update( + resource_group_name=resource_group.name, + account_name="str", + management_policy_name="str", + properties={ + "id": "str", + "lastModifiedTime": "2020-02-20 00:00:00", + "name": "str", + "policy": { + "rules": [ + { + "definition": { + "actions": { + "baseBlob": { + "delete": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastAccessTimeGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + "daysAfterModificationGreaterThan": 0.0, + }, + "enableAutoTierToHotFromCool": bool, + "tierToArchive": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastAccessTimeGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + "daysAfterModificationGreaterThan": 0.0, + }, + "tierToCold": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastAccessTimeGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + "daysAfterModificationGreaterThan": 0.0, + }, + "tierToCool": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastAccessTimeGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + "daysAfterModificationGreaterThan": 0.0, + }, + "tierToHot": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastAccessTimeGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + "daysAfterModificationGreaterThan": 0.0, + }, + }, + "snapshot": { + "delete": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + }, + "tierToArchive": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + }, + "tierToCold": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + }, + "tierToCool": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + }, + "tierToHot": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + }, + }, + "version": { + "delete": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + }, + "tierToArchive": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + }, + "tierToCold": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + }, + "tierToCool": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + }, + "tierToHot": { + "daysAfterCreationGreaterThan": 0.0, + "daysAfterLastTierChangeGreaterThan": 0.0, + }, + }, + }, + "filters": { + "blobTypes": ["str"], + "blobIndexMatch": [{"name": "str", "op": "str", "value": "str"}], + "prefixMatch": ["str"], + }, + }, + "name": "str", + "type": "str", + "enabled": bool, + } + ] + }, + "type": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_management_policies_delete(self, resource_group): + response = await self.client.management_policies.delete( + resource_group_name=resource_group.name, + account_name="str", + management_policy_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_network_security_perimeter_configurations_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_network_security_perimeter_configurations_operations.py new file mode 100644 index 000000000000..2aa5c3408026 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_network_security_perimeter_configurations_operations.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementNetworkSecurityPerimeterConfigurationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_network_security_perimeter_configurations_list(self, resource_group): + response = self.client.network_security_perimeter_configurations.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_network_security_perimeter_configurations_get(self, resource_group): + response = self.client.network_security_perimeter_configurations.get( + resource_group_name=resource_group.name, + account_name="str", + network_security_perimeter_configuration_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_network_security_perimeter_configurations_begin_reconcile(self, resource_group): + response = self.client.network_security_perimeter_configurations.begin_reconcile( + resource_group_name=resource_group.name, + account_name="str", + network_security_perimeter_configuration_name="str", + api_version="2023-05-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_network_security_perimeter_configurations_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_network_security_perimeter_configurations_operations_async.py new file mode 100644 index 000000000000..ce6759395f4b --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_network_security_perimeter_configurations_operations_async.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementNetworkSecurityPerimeterConfigurationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_network_security_perimeter_configurations_list(self, resource_group): + response = self.client.network_security_perimeter_configurations.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_network_security_perimeter_configurations_get(self, resource_group): + response = await self.client.network_security_perimeter_configurations.get( + resource_group_name=resource_group.name, + account_name="str", + network_security_perimeter_configuration_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_network_security_perimeter_configurations_begin_reconcile(self, resource_group): + response = await ( + await self.client.network_security_perimeter_configurations.begin_reconcile( + resource_group_name=resource_group.name, + account_name="str", + network_security_perimeter_configuration_name="str", + api_version="2023-05-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_object_replication_policies_operations.py new file mode 100644 index 000000000000..c5e97c4e0852 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_object_replication_policies_operations.py @@ -0,0 +1,87 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementObjectReplicationPoliciesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_object_replication_policies_list(self, resource_group): + response = self.client.object_replication_policies.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_object_replication_policies_get(self, resource_group): + response = self.client.object_replication_policies.get( + resource_group_name=resource_group.name, + account_name="str", + object_replication_policy_id="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_object_replication_policies_create_or_update(self, resource_group): + response = self.client.object_replication_policies.create_or_update( + resource_group_name=resource_group.name, + account_name="str", + object_replication_policy_id="str", + properties={ + "destinationAccount": "str", + "enabledTime": "2020-02-20 00:00:00", + "id": "str", + "name": "str", + "policyId": "str", + "rules": [ + { + "destinationContainer": "str", + "sourceContainer": "str", + "filters": {"minCreationTime": "str", "prefixMatch": ["str"]}, + "ruleId": "str", + } + ], + "sourceAccount": "str", + "type": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_object_replication_policies_delete(self, resource_group): + response = self.client.object_replication_policies.delete( + resource_group_name=resource_group.name, + account_name="str", + object_replication_policy_id="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_object_replication_policies_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_object_replication_policies_operations_async.py new file mode 100644 index 000000000000..a1f5e72b3613 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_object_replication_policies_operations_async.py @@ -0,0 +1,88 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementObjectReplicationPoliciesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_object_replication_policies_list(self, resource_group): + response = self.client.object_replication_policies.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_object_replication_policies_get(self, resource_group): + response = await self.client.object_replication_policies.get( + resource_group_name=resource_group.name, + account_name="str", + object_replication_policy_id="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_object_replication_policies_create_or_update(self, resource_group): + response = await self.client.object_replication_policies.create_or_update( + resource_group_name=resource_group.name, + account_name="str", + object_replication_policy_id="str", + properties={ + "destinationAccount": "str", + "enabledTime": "2020-02-20 00:00:00", + "id": "str", + "name": "str", + "policyId": "str", + "rules": [ + { + "destinationContainer": "str", + "sourceContainer": "str", + "filters": {"minCreationTime": "str", "prefixMatch": ["str"]}, + "ruleId": "str", + } + ], + "sourceAccount": "str", + "type": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_object_replication_policies_delete(self, resource_group): + response = await self.client.object_replication_policies.delete( + resource_group_name=resource_group.name, + account_name="str", + object_replication_policy_id="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_operations.py new file mode 100644 index 000000000000..4ba4fd6bca42 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_operations.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operations_list(self, resource_group): + response = self.client.operations.list( + api_version="2023-05-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_operations_async.py new file mode 100644 index 000000000000..fa67c04a205f --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_operations_async.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operations_list(self, resource_group): + response = self.client.operations.list( + api_version="2023-05-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_private_endpoint_connections_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..31f7271a917f --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_private_endpoint_connections_operations.py @@ -0,0 +1,78 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementPrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_list(self, resource_group): + response = self.client.private_endpoint_connections.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_get(self, resource_group): + response = self.client.private_endpoint_connections.get( + resource_group_name=resource_group.name, + account_name="str", + private_endpoint_connection_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_put(self, resource_group): + response = self.client.private_endpoint_connections.put( + resource_group_name=resource_group.name, + account_name="str", + private_endpoint_connection_name="str", + properties={ + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": {"actionRequired": "str", "description": "str", "status": "str"}, + "provisioningState": "str", + "type": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_delete(self, resource_group): + response = self.client.private_endpoint_connections.delete( + resource_group_name=resource_group.name, + account_name="str", + private_endpoint_connection_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_private_endpoint_connections_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_private_endpoint_connections_operations_async.py new file mode 100644 index 000000000000..5b62e2e518c3 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_private_endpoint_connections_operations_async.py @@ -0,0 +1,79 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementPrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_list(self, resource_group): + response = self.client.private_endpoint_connections.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_get(self, resource_group): + response = await self.client.private_endpoint_connections.get( + resource_group_name=resource_group.name, + account_name="str", + private_endpoint_connection_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_put(self, resource_group): + response = await self.client.private_endpoint_connections.put( + resource_group_name=resource_group.name, + account_name="str", + private_endpoint_connection_name="str", + properties={ + "id": "str", + "name": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": {"actionRequired": "str", "description": "str", "status": "str"}, + "provisioningState": "str", + "type": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_delete(self, resource_group): + response = await self.client.private_endpoint_connections.delete( + resource_group_name=resource_group.name, + account_name="str", + private_endpoint_connection_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_private_link_resources_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_private_link_resources_operations.py new file mode 100644 index 000000000000..dfc0b948e21c --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_private_link_resources_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementPrivateLinkResourcesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_link_resources_list_by_storage_account(self, resource_group): + response = self.client.private_link_resources.list_by_storage_account( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_private_link_resources_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_private_link_resources_operations_async.py new file mode 100644 index 000000000000..2ba8169c9540 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_private_link_resources_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementPrivateLinkResourcesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_link_resources_list_by_storage_account(self, resource_group): + response = await self.client.private_link_resources.list_by_storage_account( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_queue_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_queue_operations.py new file mode 100644 index 000000000000..f23660bc4ba8 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_queue_operations.py @@ -0,0 +1,85 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementQueueOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_queue_create(self, resource_group): + response = self.client.queue.create( + resource_group_name=resource_group.name, + account_name="str", + queue_name="str", + queue={"approximateMessageCount": 0, "id": "str", "metadata": {"str": "str"}, "name": "str", "type": "str"}, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_queue_update(self, resource_group): + response = self.client.queue.update( + resource_group_name=resource_group.name, + account_name="str", + queue_name="str", + queue={"approximateMessageCount": 0, "id": "str", "metadata": {"str": "str"}, "name": "str", "type": "str"}, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_queue_get(self, resource_group): + response = self.client.queue.get( + resource_group_name=resource_group.name, + account_name="str", + queue_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_queue_delete(self, resource_group): + response = self.client.queue.delete( + resource_group_name=resource_group.name, + account_name="str", + queue_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_queue_list(self, resource_group): + response = self.client.queue.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_queue_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_queue_operations_async.py new file mode 100644 index 000000000000..a735fad6059c --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_queue_operations_async.py @@ -0,0 +1,86 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementQueueOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_queue_create(self, resource_group): + response = await self.client.queue.create( + resource_group_name=resource_group.name, + account_name="str", + queue_name="str", + queue={"approximateMessageCount": 0, "id": "str", "metadata": {"str": "str"}, "name": "str", "type": "str"}, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_queue_update(self, resource_group): + response = await self.client.queue.update( + resource_group_name=resource_group.name, + account_name="str", + queue_name="str", + queue={"approximateMessageCount": 0, "id": "str", "metadata": {"str": "str"}, "name": "str", "type": "str"}, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_queue_get(self, resource_group): + response = await self.client.queue.get( + resource_group_name=resource_group.name, + account_name="str", + queue_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_queue_delete(self, resource_group): + response = await self.client.queue.delete( + resource_group_name=resource_group.name, + account_name="str", + queue_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_queue_list(self, resource_group): + response = self.client.queue.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_queue_services_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_queue_services_operations.py new file mode 100644 index 000000000000..6763db2f8cab --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_queue_services_operations.py @@ -0,0 +1,73 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementQueueServicesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_queue_services_list(self, resource_group): + response = self.client.queue_services.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_queue_services_set_service_properties(self, resource_group): + response = self.client.queue_services.set_service_properties( + resource_group_name=resource_group.name, + account_name="str", + parameters={ + "cors": { + "corsRules": [ + { + "allowedHeaders": ["str"], + "allowedMethods": ["str"], + "allowedOrigins": ["str"], + "exposedHeaders": ["str"], + "maxAgeInSeconds": 0, + } + ] + }, + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2023-05-01", + queue_service_name="default", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_queue_services_get_service_properties(self, resource_group): + response = self.client.queue_services.get_service_properties( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + queue_service_name="default", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_queue_services_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_queue_services_operations_async.py new file mode 100644 index 000000000000..d69edc1c2bb5 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_queue_services_operations_async.py @@ -0,0 +1,74 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementQueueServicesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_queue_services_list(self, resource_group): + response = await self.client.queue_services.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_queue_services_set_service_properties(self, resource_group): + response = await self.client.queue_services.set_service_properties( + resource_group_name=resource_group.name, + account_name="str", + parameters={ + "cors": { + "corsRules": [ + { + "allowedHeaders": ["str"], + "allowedMethods": ["str"], + "allowedOrigins": ["str"], + "exposedHeaders": ["str"], + "maxAgeInSeconds": 0, + } + ] + }, + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2023-05-01", + queue_service_name="default", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_queue_services_get_service_properties(self, resource_group): + response = await self.client.queue_services.get_service_properties( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + queue_service_name="default", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_skus_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_skus_operations.py new file mode 100644 index 000000000000..c11eda407acb --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_skus_operations.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementSkusOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_skus_list(self, resource_group): + response = self.client.skus.list( + api_version="2023-05-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_skus_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_skus_operations_async.py new file mode 100644 index 000000000000..353907f10b52 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_skus_operations_async.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementSkusOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_skus_list(self, resource_group): + response = self.client.skus.list( + api_version="2023-05-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_accounts_operations.py new file mode 100644 index 000000000000..d8a2bb7e29c7 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_accounts_operations.py @@ -0,0 +1,443 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementStorageAccountsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_accounts_check_name_availability(self, resource_group): + response = self.client.storage_accounts.check_name_availability( + account_name={"name": "str", "type": "Microsoft.Storage/storageAccounts"}, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_accounts_begin_create(self, resource_group): + response = self.client.storage_accounts.begin_create( + resource_group_name=resource_group.name, + account_name="str", + parameters={ + "kind": "str", + "location": "str", + "sku": {"name": "str", "tier": "str"}, + "accessTier": "str", + "allowBlobPublicAccess": bool, + "allowCrossTenantReplication": bool, + "allowSharedKeyAccess": bool, + "allowedCopyScope": "str", + "azureFilesIdentityBasedAuthentication": { + "directoryServiceOptions": "str", + "activeDirectoryProperties": { + "domainGuid": "str", + "domainName": "str", + "accountType": "str", + "azureStorageSid": "str", + "domainSid": "str", + "forestName": "str", + "netBiosDomainName": "str", + "samAccountName": "str", + }, + "defaultSharePermission": "str", + }, + "customDomain": {"name": "str", "useSubDomainName": bool}, + "defaultToOAuthAuthentication": bool, + "dnsEndpointType": "str", + "enableExtendedGroups": bool, + "encryption": { + "identity": {"federatedIdentityClientId": "str", "userAssignedIdentity": "str"}, + "keySource": "Microsoft.Storage", + "keyvaultproperties": { + "currentVersionedKeyExpirationTimestamp": "2020-02-20 00:00:00", + "currentVersionedKeyIdentifier": "str", + "keyname": "str", + "keyvaulturi": "str", + "keyversion": "str", + "lastKeyRotationTimestamp": "2020-02-20 00:00:00", + }, + "requireInfrastructureEncryption": bool, + "services": { + "blob": {"enabled": bool, "keyType": "str", "lastEnabledTime": "2020-02-20 00:00:00"}, + "file": {"enabled": bool, "keyType": "str", "lastEnabledTime": "2020-02-20 00:00:00"}, + "queue": {"enabled": bool, "keyType": "str", "lastEnabledTime": "2020-02-20 00:00:00"}, + "table": {"enabled": bool, "keyType": "str", "lastEnabledTime": "2020-02-20 00:00:00"}, + }, + }, + "extendedLocation": {"name": "str", "type": "str"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "immutableStorageWithVersioning": { + "enabled": bool, + "immutabilityPolicy": { + "allowProtectedAppendWrites": bool, + "immutabilityPeriodSinceCreationInDays": 0, + "state": "str", + }, + }, + "isHnsEnabled": bool, + "isLocalUserEnabled": bool, + "isNfsV3Enabled": bool, + "isSftpEnabled": bool, + "keyPolicy": {"keyExpirationPeriodInDays": 0}, + "largeFileSharesState": "str", + "minimumTlsVersion": "str", + "networkAcls": { + "defaultAction": "Allow", + "bypass": "AzureServices", + "ipRules": [{"value": "str", "action": "Allow"}], + "resourceAccessRules": [{"resourceId": "str", "tenantId": "str"}], + "virtualNetworkRules": [{"id": "str", "action": "Allow", "state": "str"}], + }, + "publicNetworkAccess": "str", + "routingPreference": { + "publishInternetEndpoints": bool, + "publishMicrosoftEndpoints": bool, + "routingChoice": "str", + }, + "sasPolicy": {"expirationAction": "Log", "sasExpirationPeriod": "str"}, + "supportsHttpsTrafficOnly": bool, + "tags": {"str": "str"}, + }, + api_version="2023-05-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_accounts_delete(self, resource_group): + response = self.client.storage_accounts.delete( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_accounts_get_properties(self, resource_group): + response = self.client.storage_accounts.get_properties( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_accounts_update(self, resource_group): + response = self.client.storage_accounts.update( + resource_group_name=resource_group.name, + account_name="str", + parameters={ + "accessTier": "str", + "allowBlobPublicAccess": bool, + "allowCrossTenantReplication": bool, + "allowSharedKeyAccess": bool, + "allowedCopyScope": "str", + "azureFilesIdentityBasedAuthentication": { + "directoryServiceOptions": "str", + "activeDirectoryProperties": { + "domainGuid": "str", + "domainName": "str", + "accountType": "str", + "azureStorageSid": "str", + "domainSid": "str", + "forestName": "str", + "netBiosDomainName": "str", + "samAccountName": "str", + }, + "defaultSharePermission": "str", + }, + "customDomain": {"name": "str", "useSubDomainName": bool}, + "defaultToOAuthAuthentication": bool, + "dnsEndpointType": "str", + "enableExtendedGroups": bool, + "encryption": { + "identity": {"federatedIdentityClientId": "str", "userAssignedIdentity": "str"}, + "keySource": "Microsoft.Storage", + "keyvaultproperties": { + "currentVersionedKeyExpirationTimestamp": "2020-02-20 00:00:00", + "currentVersionedKeyIdentifier": "str", + "keyname": "str", + "keyvaulturi": "str", + "keyversion": "str", + "lastKeyRotationTimestamp": "2020-02-20 00:00:00", + }, + "requireInfrastructureEncryption": bool, + "services": { + "blob": {"enabled": bool, "keyType": "str", "lastEnabledTime": "2020-02-20 00:00:00"}, + "file": {"enabled": bool, "keyType": "str", "lastEnabledTime": "2020-02-20 00:00:00"}, + "queue": {"enabled": bool, "keyType": "str", "lastEnabledTime": "2020-02-20 00:00:00"}, + "table": {"enabled": bool, "keyType": "str", "lastEnabledTime": "2020-02-20 00:00:00"}, + }, + }, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "immutableStorageWithVersioning": { + "enabled": bool, + "immutabilityPolicy": { + "allowProtectedAppendWrites": bool, + "immutabilityPeriodSinceCreationInDays": 0, + "state": "str", + }, + }, + "isLocalUserEnabled": bool, + "isSftpEnabled": bool, + "keyPolicy": {"keyExpirationPeriodInDays": 0}, + "kind": "str", + "largeFileSharesState": "str", + "minimumTlsVersion": "str", + "networkAcls": { + "defaultAction": "Allow", + "bypass": "AzureServices", + "ipRules": [{"value": "str", "action": "Allow"}], + "resourceAccessRules": [{"resourceId": "str", "tenantId": "str"}], + "virtualNetworkRules": [{"id": "str", "action": "Allow", "state": "str"}], + }, + "publicNetworkAccess": "str", + "routingPreference": { + "publishInternetEndpoints": bool, + "publishMicrosoftEndpoints": bool, + "routingChoice": "str", + }, + "sasPolicy": {"expirationAction": "Log", "sasExpirationPeriod": "str"}, + "sku": {"name": "str", "tier": "str"}, + "supportsHttpsTrafficOnly": bool, + "tags": {"str": "str"}, + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_accounts_list(self, resource_group): + response = self.client.storage_accounts.list( + api_version="2023-05-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_accounts_list_by_resource_group(self, resource_group): + response = self.client.storage_accounts.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-05-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_accounts_list_keys(self, resource_group): + response = self.client.storage_accounts.list_keys( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_accounts_regenerate_key(self, resource_group): + response = self.client.storage_accounts.regenerate_key( + resource_group_name=resource_group.name, + account_name="str", + regenerate_key={"keyName": "str"}, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_accounts_list_account_sas(self, resource_group): + response = self.client.storage_accounts.list_account_sas( + resource_group_name=resource_group.name, + account_name="str", + parameters={ + "signedExpiry": "2020-02-20 00:00:00", + "signedPermission": "str", + "signedResourceTypes": "str", + "signedServices": "str", + "keyToSign": "str", + "signedIp": "str", + "signedProtocol": "str", + "signedStart": "2020-02-20 00:00:00", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_accounts_list_service_sas(self, resource_group): + response = self.client.storage_accounts.list_service_sas( + resource_group_name=resource_group.name, + account_name="str", + parameters={ + "canonicalizedResource": "str", + "endPk": "str", + "endRk": "str", + "keyToSign": "str", + "rscc": "str", + "rscd": "str", + "rsce": "str", + "rscl": "str", + "rsct": "str", + "signedExpiry": "2020-02-20 00:00:00", + "signedIdentifier": "str", + "signedIp": "str", + "signedPermission": "str", + "signedProtocol": "str", + "signedResource": "str", + "signedStart": "2020-02-20 00:00:00", + "startPk": "str", + "startRk": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_accounts_begin_failover(self, resource_group): + response = self.client.storage_accounts.begin_failover( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_accounts_begin_hierarchical_namespace_migration(self, resource_group): + response = self.client.storage_accounts.begin_hierarchical_namespace_migration( + resource_group_name=resource_group.name, + account_name="str", + request_type="str", + api_version="2023-05-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_accounts_begin_abort_hierarchical_namespace_migration(self, resource_group): + response = self.client.storage_accounts.begin_abort_hierarchical_namespace_migration( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_accounts_begin_customer_initiated_migration(self, resource_group): + response = self.client.storage_accounts.begin_customer_initiated_migration( + resource_group_name=resource_group.name, + account_name="str", + parameters={ + "targetSkuName": "str", + "id": "str", + "migrationFailedDetailedReason": "str", + "migrationFailedReason": "str", + "migrationStatus": "str", + "name": "str", + "type": "str", + }, + api_version="2023-05-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_accounts_get_customer_initiated_migration(self, resource_group): + response = self.client.storage_accounts.get_customer_initiated_migration( + resource_group_name=resource_group.name, + account_name="str", + migration_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_accounts_begin_restore_blob_ranges(self, resource_group): + response = self.client.storage_accounts.begin_restore_blob_ranges( + resource_group_name=resource_group.name, + account_name="str", + parameters={ + "blobRanges": [{"endRange": "str", "startRange": "str"}], + "timeToRestore": "2020-02-20 00:00:00", + }, + api_version="2023-05-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_accounts_revoke_user_delegation_keys(self, resource_group): + response = self.client.storage_accounts.revoke_user_delegation_keys( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_accounts_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_accounts_operations_async.py new file mode 100644 index 000000000000..048933df0f92 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_accounts_operations_async.py @@ -0,0 +1,456 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementStorageAccountsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_accounts_check_name_availability(self, resource_group): + response = await self.client.storage_accounts.check_name_availability( + account_name={"name": "str", "type": "Microsoft.Storage/storageAccounts"}, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_accounts_begin_create(self, resource_group): + response = await ( + await self.client.storage_accounts.begin_create( + resource_group_name=resource_group.name, + account_name="str", + parameters={ + "kind": "str", + "location": "str", + "sku": {"name": "str", "tier": "str"}, + "accessTier": "str", + "allowBlobPublicAccess": bool, + "allowCrossTenantReplication": bool, + "allowSharedKeyAccess": bool, + "allowedCopyScope": "str", + "azureFilesIdentityBasedAuthentication": { + "directoryServiceOptions": "str", + "activeDirectoryProperties": { + "domainGuid": "str", + "domainName": "str", + "accountType": "str", + "azureStorageSid": "str", + "domainSid": "str", + "forestName": "str", + "netBiosDomainName": "str", + "samAccountName": "str", + }, + "defaultSharePermission": "str", + }, + "customDomain": {"name": "str", "useSubDomainName": bool}, + "defaultToOAuthAuthentication": bool, + "dnsEndpointType": "str", + "enableExtendedGroups": bool, + "encryption": { + "identity": {"federatedIdentityClientId": "str", "userAssignedIdentity": "str"}, + "keySource": "Microsoft.Storage", + "keyvaultproperties": { + "currentVersionedKeyExpirationTimestamp": "2020-02-20 00:00:00", + "currentVersionedKeyIdentifier": "str", + "keyname": "str", + "keyvaulturi": "str", + "keyversion": "str", + "lastKeyRotationTimestamp": "2020-02-20 00:00:00", + }, + "requireInfrastructureEncryption": bool, + "services": { + "blob": {"enabled": bool, "keyType": "str", "lastEnabledTime": "2020-02-20 00:00:00"}, + "file": {"enabled": bool, "keyType": "str", "lastEnabledTime": "2020-02-20 00:00:00"}, + "queue": {"enabled": bool, "keyType": "str", "lastEnabledTime": "2020-02-20 00:00:00"}, + "table": {"enabled": bool, "keyType": "str", "lastEnabledTime": "2020-02-20 00:00:00"}, + }, + }, + "extendedLocation": {"name": "str", "type": "str"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "immutableStorageWithVersioning": { + "enabled": bool, + "immutabilityPolicy": { + "allowProtectedAppendWrites": bool, + "immutabilityPeriodSinceCreationInDays": 0, + "state": "str", + }, + }, + "isHnsEnabled": bool, + "isLocalUserEnabled": bool, + "isNfsV3Enabled": bool, + "isSftpEnabled": bool, + "keyPolicy": {"keyExpirationPeriodInDays": 0}, + "largeFileSharesState": "str", + "minimumTlsVersion": "str", + "networkAcls": { + "defaultAction": "Allow", + "bypass": "AzureServices", + "ipRules": [{"value": "str", "action": "Allow"}], + "resourceAccessRules": [{"resourceId": "str", "tenantId": "str"}], + "virtualNetworkRules": [{"id": "str", "action": "Allow", "state": "str"}], + }, + "publicNetworkAccess": "str", + "routingPreference": { + "publishInternetEndpoints": bool, + "publishMicrosoftEndpoints": bool, + "routingChoice": "str", + }, + "sasPolicy": {"expirationAction": "Log", "sasExpirationPeriod": "str"}, + "supportsHttpsTrafficOnly": bool, + "tags": {"str": "str"}, + }, + api_version="2023-05-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_accounts_delete(self, resource_group): + response = await self.client.storage_accounts.delete( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_accounts_get_properties(self, resource_group): + response = await self.client.storage_accounts.get_properties( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_accounts_update(self, resource_group): + response = await self.client.storage_accounts.update( + resource_group_name=resource_group.name, + account_name="str", + parameters={ + "accessTier": "str", + "allowBlobPublicAccess": bool, + "allowCrossTenantReplication": bool, + "allowSharedKeyAccess": bool, + "allowedCopyScope": "str", + "azureFilesIdentityBasedAuthentication": { + "directoryServiceOptions": "str", + "activeDirectoryProperties": { + "domainGuid": "str", + "domainName": "str", + "accountType": "str", + "azureStorageSid": "str", + "domainSid": "str", + "forestName": "str", + "netBiosDomainName": "str", + "samAccountName": "str", + }, + "defaultSharePermission": "str", + }, + "customDomain": {"name": "str", "useSubDomainName": bool}, + "defaultToOAuthAuthentication": bool, + "dnsEndpointType": "str", + "enableExtendedGroups": bool, + "encryption": { + "identity": {"federatedIdentityClientId": "str", "userAssignedIdentity": "str"}, + "keySource": "Microsoft.Storage", + "keyvaultproperties": { + "currentVersionedKeyExpirationTimestamp": "2020-02-20 00:00:00", + "currentVersionedKeyIdentifier": "str", + "keyname": "str", + "keyvaulturi": "str", + "keyversion": "str", + "lastKeyRotationTimestamp": "2020-02-20 00:00:00", + }, + "requireInfrastructureEncryption": bool, + "services": { + "blob": {"enabled": bool, "keyType": "str", "lastEnabledTime": "2020-02-20 00:00:00"}, + "file": {"enabled": bool, "keyType": "str", "lastEnabledTime": "2020-02-20 00:00:00"}, + "queue": {"enabled": bool, "keyType": "str", "lastEnabledTime": "2020-02-20 00:00:00"}, + "table": {"enabled": bool, "keyType": "str", "lastEnabledTime": "2020-02-20 00:00:00"}, + }, + }, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "immutableStorageWithVersioning": { + "enabled": bool, + "immutabilityPolicy": { + "allowProtectedAppendWrites": bool, + "immutabilityPeriodSinceCreationInDays": 0, + "state": "str", + }, + }, + "isLocalUserEnabled": bool, + "isSftpEnabled": bool, + "keyPolicy": {"keyExpirationPeriodInDays": 0}, + "kind": "str", + "largeFileSharesState": "str", + "minimumTlsVersion": "str", + "networkAcls": { + "defaultAction": "Allow", + "bypass": "AzureServices", + "ipRules": [{"value": "str", "action": "Allow"}], + "resourceAccessRules": [{"resourceId": "str", "tenantId": "str"}], + "virtualNetworkRules": [{"id": "str", "action": "Allow", "state": "str"}], + }, + "publicNetworkAccess": "str", + "routingPreference": { + "publishInternetEndpoints": bool, + "publishMicrosoftEndpoints": bool, + "routingChoice": "str", + }, + "sasPolicy": {"expirationAction": "Log", "sasExpirationPeriod": "str"}, + "sku": {"name": "str", "tier": "str"}, + "supportsHttpsTrafficOnly": bool, + "tags": {"str": "str"}, + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_accounts_list(self, resource_group): + response = self.client.storage_accounts.list( + api_version="2023-05-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_accounts_list_by_resource_group(self, resource_group): + response = self.client.storage_accounts.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2023-05-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_accounts_list_keys(self, resource_group): + response = await self.client.storage_accounts.list_keys( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_accounts_regenerate_key(self, resource_group): + response = await self.client.storage_accounts.regenerate_key( + resource_group_name=resource_group.name, + account_name="str", + regenerate_key={"keyName": "str"}, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_accounts_list_account_sas(self, resource_group): + response = await self.client.storage_accounts.list_account_sas( + resource_group_name=resource_group.name, + account_name="str", + parameters={ + "signedExpiry": "2020-02-20 00:00:00", + "signedPermission": "str", + "signedResourceTypes": "str", + "signedServices": "str", + "keyToSign": "str", + "signedIp": "str", + "signedProtocol": "str", + "signedStart": "2020-02-20 00:00:00", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_accounts_list_service_sas(self, resource_group): + response = await self.client.storage_accounts.list_service_sas( + resource_group_name=resource_group.name, + account_name="str", + parameters={ + "canonicalizedResource": "str", + "endPk": "str", + "endRk": "str", + "keyToSign": "str", + "rscc": "str", + "rscd": "str", + "rsce": "str", + "rscl": "str", + "rsct": "str", + "signedExpiry": "2020-02-20 00:00:00", + "signedIdentifier": "str", + "signedIp": "str", + "signedPermission": "str", + "signedProtocol": "str", + "signedResource": "str", + "signedStart": "2020-02-20 00:00:00", + "startPk": "str", + "startRk": "str", + }, + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_accounts_begin_failover(self, resource_group): + response = await ( + await self.client.storage_accounts.begin_failover( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_accounts_begin_hierarchical_namespace_migration(self, resource_group): + response = await ( + await self.client.storage_accounts.begin_hierarchical_namespace_migration( + resource_group_name=resource_group.name, + account_name="str", + request_type="str", + api_version="2023-05-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_accounts_begin_abort_hierarchical_namespace_migration(self, resource_group): + response = await ( + await self.client.storage_accounts.begin_abort_hierarchical_namespace_migration( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_accounts_begin_customer_initiated_migration(self, resource_group): + response = await ( + await self.client.storage_accounts.begin_customer_initiated_migration( + resource_group_name=resource_group.name, + account_name="str", + parameters={ + "targetSkuName": "str", + "id": "str", + "migrationFailedDetailedReason": "str", + "migrationFailedReason": "str", + "migrationStatus": "str", + "name": "str", + "type": "str", + }, + api_version="2023-05-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_accounts_get_customer_initiated_migration(self, resource_group): + response = await self.client.storage_accounts.get_customer_initiated_migration( + resource_group_name=resource_group.name, + account_name="str", + migration_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_accounts_begin_restore_blob_ranges(self, resource_group): + response = await ( + await self.client.storage_accounts.begin_restore_blob_ranges( + resource_group_name=resource_group.name, + account_name="str", + parameters={ + "blobRanges": [{"endRange": "str", "startRange": "str"}], + "timeToRestore": "2020-02-20 00:00:00", + }, + api_version="2023-05-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_accounts_revoke_user_delegation_keys(self, resource_group): + response = await self.client.storage_accounts.revoke_user_delegation_keys( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_task_assignment_instances_report_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_task_assignment_instances_report_operations.py new file mode 100644 index 000000000000..9e62d56e83a3 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_task_assignment_instances_report_operations.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementStorageTaskAssignmentInstancesReportOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_task_assignment_instances_report_list(self, resource_group): + response = self.client.storage_task_assignment_instances_report.list( + resource_group_name=resource_group.name, + account_name="str", + storage_task_assignment_name="str", + api_version="2023-05-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_task_assignment_instances_report_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_task_assignment_instances_report_operations_async.py new file mode 100644 index 000000000000..144191865d15 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_task_assignment_instances_report_operations_async.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementStorageTaskAssignmentInstancesReportOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_task_assignment_instances_report_list(self, resource_group): + response = self.client.storage_task_assignment_instances_report.list( + resource_group_name=resource_group.name, + account_name="str", + storage_task_assignment_name="str", + api_version="2023-05-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_task_assignments_instances_report_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_task_assignments_instances_report_operations.py new file mode 100644 index 000000000000..6a2e1249e98a --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_task_assignments_instances_report_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementStorageTaskAssignmentsInstancesReportOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_task_assignments_instances_report_list(self, resource_group): + response = self.client.storage_task_assignments_instances_report.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_task_assignments_instances_report_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_task_assignments_instances_report_operations_async.py new file mode 100644 index 000000000000..30efc30ba81e --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_task_assignments_instances_report_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementStorageTaskAssignmentsInstancesReportOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_task_assignments_instances_report_list(self, resource_group): + response = self.client.storage_task_assignments_instances_report.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_task_assignments_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_task_assignments_operations.py new file mode 100644 index 000000000000..72fc8c774248 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_task_assignments_operations.py @@ -0,0 +1,162 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementStorageTaskAssignmentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_task_assignments_begin_create(self, resource_group): + response = self.client.storage_task_assignments.begin_create( + resource_group_name=resource_group.name, + account_name="str", + storage_task_assignment_name="str", + parameters={ + "properties": { + "description": "str", + "enabled": bool, + "executionContext": { + "trigger": { + "parameters": { + "endBy": "2020-02-20 00:00:00", + "interval": 0, + "intervalUnit": "Days", + "startFrom": "2020-02-20 00:00:00", + "startOn": "2020-02-20 00:00:00", + }, + "type": "str", + }, + "target": {"excludePrefix": ["str"], "prefix": ["str"]}, + }, + "report": {"prefix": "str"}, + "taskId": "str", + "provisioningState": "str", + "runStatus": { + "finishTime": "str", + "objectFailedCount": "str", + "objectsOperatedOnCount": "str", + "objectsSucceededCount": "str", + "objectsTargetedCount": "str", + "runResult": "str", + "runStatusEnum": "str", + "runStatusError": "str", + "startTime": "str", + "storageAccountId": "str", + "summaryReportPath": "str", + "taskAssignmentId": "str", + "taskId": "str", + "taskVersion": "str", + }, + }, + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2023-05-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_task_assignments_begin_update(self, resource_group): + response = self.client.storage_task_assignments.begin_update( + resource_group_name=resource_group.name, + account_name="str", + storage_task_assignment_name="str", + parameters={ + "properties": { + "description": "str", + "enabled": bool, + "executionContext": { + "target": {"excludePrefix": ["str"], "prefix": ["str"]}, + "trigger": { + "parameters": { + "endBy": "2020-02-20 00:00:00", + "interval": 0, + "intervalUnit": "Days", + "startFrom": "2020-02-20 00:00:00", + "startOn": "2020-02-20 00:00:00", + }, + "type": "str", + }, + }, + "provisioningState": "str", + "report": {"prefix": "str"}, + "runStatus": { + "finishTime": "str", + "objectFailedCount": "str", + "objectsOperatedOnCount": "str", + "objectsSucceededCount": "str", + "objectsTargetedCount": "str", + "runResult": "str", + "runStatusEnum": "str", + "runStatusError": "str", + "startTime": "str", + "storageAccountId": "str", + "summaryReportPath": "str", + "taskAssignmentId": "str", + "taskId": "str", + "taskVersion": "str", + }, + "taskId": "str", + } + }, + api_version="2023-05-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_task_assignments_get(self, resource_group): + response = self.client.storage_task_assignments.get( + resource_group_name=resource_group.name, + account_name="str", + storage_task_assignment_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_task_assignments_begin_delete(self, resource_group): + response = self.client.storage_task_assignments.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + storage_task_assignment_name="str", + api_version="2023-05-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_storage_task_assignments_list(self, resource_group): + response = self.client.storage_task_assignments.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_task_assignments_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_task_assignments_operations_async.py new file mode 100644 index 000000000000..7790ec72fe2a --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_storage_task_assignments_operations_async.py @@ -0,0 +1,169 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementStorageTaskAssignmentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_task_assignments_begin_create(self, resource_group): + response = await ( + await self.client.storage_task_assignments.begin_create( + resource_group_name=resource_group.name, + account_name="str", + storage_task_assignment_name="str", + parameters={ + "properties": { + "description": "str", + "enabled": bool, + "executionContext": { + "trigger": { + "parameters": { + "endBy": "2020-02-20 00:00:00", + "interval": 0, + "intervalUnit": "Days", + "startFrom": "2020-02-20 00:00:00", + "startOn": "2020-02-20 00:00:00", + }, + "type": "str", + }, + "target": {"excludePrefix": ["str"], "prefix": ["str"]}, + }, + "report": {"prefix": "str"}, + "taskId": "str", + "provisioningState": "str", + "runStatus": { + "finishTime": "str", + "objectFailedCount": "str", + "objectsOperatedOnCount": "str", + "objectsSucceededCount": "str", + "objectsTargetedCount": "str", + "runResult": "str", + "runStatusEnum": "str", + "runStatusError": "str", + "startTime": "str", + "storageAccountId": "str", + "summaryReportPath": "str", + "taskAssignmentId": "str", + "taskId": "str", + "taskVersion": "str", + }, + }, + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2023-05-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_task_assignments_begin_update(self, resource_group): + response = await ( + await self.client.storage_task_assignments.begin_update( + resource_group_name=resource_group.name, + account_name="str", + storage_task_assignment_name="str", + parameters={ + "properties": { + "description": "str", + "enabled": bool, + "executionContext": { + "target": {"excludePrefix": ["str"], "prefix": ["str"]}, + "trigger": { + "parameters": { + "endBy": "2020-02-20 00:00:00", + "interval": 0, + "intervalUnit": "Days", + "startFrom": "2020-02-20 00:00:00", + "startOn": "2020-02-20 00:00:00", + }, + "type": "str", + }, + }, + "provisioningState": "str", + "report": {"prefix": "str"}, + "runStatus": { + "finishTime": "str", + "objectFailedCount": "str", + "objectsOperatedOnCount": "str", + "objectsSucceededCount": "str", + "objectsTargetedCount": "str", + "runResult": "str", + "runStatusEnum": "str", + "runStatusError": "str", + "startTime": "str", + "storageAccountId": "str", + "summaryReportPath": "str", + "taskAssignmentId": "str", + "taskId": "str", + "taskVersion": "str", + }, + "taskId": "str", + } + }, + api_version="2023-05-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_task_assignments_get(self, resource_group): + response = await self.client.storage_task_assignments.get( + resource_group_name=resource_group.name, + account_name="str", + storage_task_assignment_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_task_assignments_begin_delete(self, resource_group): + response = await ( + await self.client.storage_task_assignments.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + storage_task_assignment_name="str", + api_version="2023-05-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_storage_task_assignments_list(self, resource_group): + response = self.client.storage_task_assignments.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_table_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_table_operations.py new file mode 100644 index 000000000000..0349ee699cdc --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_table_operations.py @@ -0,0 +1,83 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementTableOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_table_create(self, resource_group): + response = self.client.table.create( + resource_group_name=resource_group.name, + account_name="str", + table_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_table_update(self, resource_group): + response = self.client.table.update( + resource_group_name=resource_group.name, + account_name="str", + table_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_table_get(self, resource_group): + response = self.client.table.get( + resource_group_name=resource_group.name, + account_name="str", + table_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_table_delete(self, resource_group): + response = self.client.table.delete( + resource_group_name=resource_group.name, + account_name="str", + table_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_table_list(self, resource_group): + response = self.client.table.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_table_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_table_operations_async.py new file mode 100644 index 000000000000..8868fd68c46d --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_table_operations_async.py @@ -0,0 +1,84 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementTableOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_table_create(self, resource_group): + response = await self.client.table.create( + resource_group_name=resource_group.name, + account_name="str", + table_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_table_update(self, resource_group): + response = await self.client.table.update( + resource_group_name=resource_group.name, + account_name="str", + table_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_table_get(self, resource_group): + response = await self.client.table.get( + resource_group_name=resource_group.name, + account_name="str", + table_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_table_delete(self, resource_group): + response = await self.client.table.delete( + resource_group_name=resource_group.name, + account_name="str", + table_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_table_list(self, resource_group): + response = self.client.table.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_table_services_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_table_services_operations.py new file mode 100644 index 000000000000..c1905e49197e --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_table_services_operations.py @@ -0,0 +1,73 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementTableServicesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_table_services_list(self, resource_group): + response = self.client.table_services.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_table_services_set_service_properties(self, resource_group): + response = self.client.table_services.set_service_properties( + resource_group_name=resource_group.name, + account_name="str", + parameters={ + "cors": { + "corsRules": [ + { + "allowedHeaders": ["str"], + "allowedMethods": ["str"], + "allowedOrigins": ["str"], + "exposedHeaders": ["str"], + "maxAgeInSeconds": 0, + } + ] + }, + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2023-05-01", + table_service_name="default", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_table_services_get_service_properties(self, resource_group): + response = self.client.table_services.get_service_properties( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + table_service_name="default", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_table_services_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_table_services_operations_async.py new file mode 100644 index 000000000000..2bed3cd1ea16 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_table_services_operations_async.py @@ -0,0 +1,74 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementTableServicesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_table_services_list(self, resource_group): + response = await self.client.table_services.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_table_services_set_service_properties(self, resource_group): + response = await self.client.table_services.set_service_properties( + resource_group_name=resource_group.name, + account_name="str", + parameters={ + "cors": { + "corsRules": [ + { + "allowedHeaders": ["str"], + "allowedMethods": ["str"], + "allowedOrigins": ["str"], + "exposedHeaders": ["str"], + "maxAgeInSeconds": 0, + } + ] + }, + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2023-05-01", + table_service_name="default", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_table_services_get_service_properties(self, resource_group): + response = await self.client.table_services.get_service_properties( + resource_group_name=resource_group.name, + account_name="str", + api_version="2023-05-01", + table_service_name="default", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_usages_operations.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_usages_operations.py new file mode 100644 index 000000000000..a436035eda35 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_usages_operations.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementUsagesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_usages_list_by_location(self, resource_group): + response = self.client.usages.list_by_location( + location="str", + api_version="2023-05-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_usages_operations_async.py b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_usages_operations_async.py new file mode 100644 index 000000000000..c4bf2fdfd73e --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/generated_tests/test_storage_management_usages_operations_async.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.storage.aio import StorageManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestStorageManagementUsagesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(StorageManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_usages_list_by_location(self, resource_group): + response = self.client.usages.list_by_location( + location="str", + api_version="2023-05-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/storage/azure-mgmt-storage/setup.py b/sdk/storage/azure-mgmt-storage/setup.py index ba4ee4bc7567..8bf8c28227a5 100644 --- a/sdk/storage/azure-mgmt-storage/setup.py +++ b/sdk/storage/azure-mgmt-storage/setup.py @@ -75,6 +75,7 @@ }, install_requires=[ "isodate>=0.6.1", + "typing-extensions>=4.6.0", "azure-common>=1.1", "azure-mgmt-core>=1.3.2", ],