diff --git a/sdk/eventhub/azure-mgmt-eventhub/_meta.json b/sdk/eventhub/azure-mgmt-eventhub/_meta.json
index 673670c9171b0..ab856329dc8c4 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/_meta.json
+++ b/sdk/eventhub/azure-mgmt-eventhub/_meta.json
@@ -1,12 +1,12 @@
{
- "commit": "b8bf9af0df9b688bf2de1eb0972810ac0e0b6185",
+ "commit": "be71f9bc6e98337c6019f7974009d7f7897e5950",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.10.2",
"use": [
- "@autorest/python@6.15.0",
+ "@autorest/python@6.27.4",
"@autorest/modelerfour@4.27.0"
],
- "autorest_command": "autorest specification/eventhub/resource-manager/readme.md --generate-sample=True --generate-test=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.15.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
+ "autorest_command": "autorest specification/eventhub/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.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
"readme": "specification/eventhub/resource-manager/readme.md",
"package-2024-01": "2024-04-17 10:03:55 -0700 bcb917a6cf4a1e47544a3acd36779cfbd58a9899 Microsoft.EventHub/stable/2024-01-01/eventhubs.json",
"package-2021-11": "2022-11-29 14:20:04 +0530 d85953a9cb1b464824fae7c1fd300a99d086c8e4 Microsoft.EventHub/stable/2021-11-01/namespaces-preview.json",
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_event_hub_management_client.py
index 0b71b8799b6b4..33e7243e478c0 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_event_hub_management_client.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_event_hub_management_client.py
@@ -96,7 +96,7 @@ def __init__(
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
self._config.http_logging_policy,
]
- self._client = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
+ self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
super(EventHubManagementClient, self).__init__(
api_version=api_version,
profile=profile
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_serialization.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_serialization.py
index 59f1fcf71bc97..a94487cbf17ac 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_serialization.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/_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:
@@ -155,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
@@ -184,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)
@@ -206,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):
@@ -235,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):
@@ -300,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:
@@ -326,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:
@@ -346,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.
@@ -382,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):
@@ -397,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
@@ -410,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
@@ -428,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
@@ -450,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:
@@ -503,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"}
@@ -542,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,
@@ -562,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)
@@ -594,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"] == "":
@@ -635,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
@@ -666,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
@@ -705,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
@@ -714,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
"""
@@ -730,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
@@ -761,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]"]:
@@ -782,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")
@@ -807,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
@@ -823,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
@@ -843,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
@@ -873,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.
@@ -884,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.")
@@ -909,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]
@@ -951,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 = {}
@@ -977,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
@@ -985,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
@@ -1009,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:
@@ -1040,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)
@@ -1097,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)
@@ -1111,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],
@@ -1147,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)
@@ -1178,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
@@ -1192,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
@@ -1217,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
@@ -1238,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)
@@ -1285,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
@@ -1337,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:
@@ -1360,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.
@@ -1369,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,
@@ -1409,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
@@ -1422,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)
@@ -1446,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"...
@@ -1482,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:
@@ -1511,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
@@ -1522,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
@@ -1537,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
)
@@ -1558,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", {})
@@ -1585,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():
@@ -1611,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
@@ -1633,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)
@@ -1653,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:
@@ -1677,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):
@@ -1687,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.
"""
@@ -1726,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
@@ -1738,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.
"""
@@ -1749,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):
@@ -1774,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,
@@ -1787,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):
@@ -1800,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:
@@ -1810,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:
@@ -1828,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.
"""
@@ -1840,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.
"""
@@ -1855,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
@@ -1871,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.
"""
@@ -1883,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.
"""
@@ -1893,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.
"""
@@ -1916,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.
"""
@@ -1930,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.
"""
@@ -1945,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.
"""
@@ -1982,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):
@@ -1991,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
"""
@@ -2002,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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/aio/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/aio/_event_hub_management_client.py
index 71be56d1cd74c..adb79efd440af 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/aio/_event_hub_management_client.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/aio/_event_hub_management_client.py
@@ -96,7 +96,7 @@ def __init__(
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
self._config.http_logging_policy,
]
- self._client = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
+ self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
super(EventHubManagementClient, self).__init__(
api_version=api_version,
profile=profile
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/__init__.py
index 7fb5add1ee3c8..2c8cfb26ae171 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_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 ._event_hub_management_client import EventHubManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._event_hub_management_client import EventHubManagementClient # 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__ = [
"EventHubManagementClient",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/_configuration.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/_configuration.py
index 5c7e6951208b3..d886b680338fb 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/_configuration.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_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 EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+class EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for EventHubManagementClient.
Note that all parameters used to create this instance are saved as instance
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/_event_hub_management_client.py
index 2fc83a4a51812..8fea15be2f52e 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/_event_hub_management_client.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/_event_hub_management_client.py
@@ -21,11 +21,10 @@
from .operations import ConsumerGroupsOperations, EventHubsOperations, NamespacesOperations, Operations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class EventHubManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class EventHubManagementClient:
"""Azure Event Hubs client.
:ivar operations: Operations operations
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/_version.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/_version.py
index 3767c560d3516..e5754a47ce68f 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/_version.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "11.1.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/__init__.py
index 699f917e93165..3cca02660c65c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_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 ._event_hub_management_client import EventHubManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._event_hub_management_client import EventHubManagementClient # 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__ = [
"EventHubManagementClient",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/_configuration.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/_configuration.py
index e4ba64d8350cf..86fb775f7a316 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/_configuration.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_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 EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+class EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for EventHubManagementClient.
Note that all parameters used to create this instance are saved as instance
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/_event_hub_management_client.py
index ae2eb63342c4b..124cc6ecc9de0 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/_event_hub_management_client.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/_event_hub_management_client.py
@@ -21,11 +21,10 @@
from .operations import ConsumerGroupsOperations, EventHubsOperations, NamespacesOperations, Operations
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class EventHubManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class EventHubManagementClient:
"""Azure Event Hubs client.
:ivar operations: Operations operations
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/operations/__init__.py
index 75a339ab21915..07c3019ad94f4 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/operations/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_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 ._namespaces_operations import NamespacesOperations
-from ._event_hubs_operations import EventHubsOperations
-from ._consumer_groups_operations import ConsumerGroupsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._operations import Operations # type: ignore
+from ._namespaces_operations import NamespacesOperations # type: ignore
+from ._event_hubs_operations import EventHubsOperations # type: ignore
+from ._consumer_groups_operations import ConsumerGroupsOperations # 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 @@
"EventHubsOperations",
"ConsumerGroupsOperations",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/operations/_consumer_groups_operations.py
index 66636147fed4c..c10ec7e9b8338 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/operations/_consumer_groups_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/operations/_consumer_groups_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -38,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]]
@@ -164,7 +163,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.ConsumerGroupResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -221,7 +220,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,
namespace_name: str,
@@ -246,7 +245,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,
@@ -312,7 +311,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.ConsumerGroupResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -384,7 +383,7 @@ def list_all(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-08-01"))
cls: ClsType[_models.ConsumerGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/operations/_event_hubs_operations.py
index 8cf09328ec8f2..80a08038f5a92 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/operations/_event_hubs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/operations/_event_hubs_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
@@ -45,7 +45,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]]
@@ -94,7 +94,7 @@ def list_all(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-08-01"))
cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -248,7 +248,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.EventHubResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -304,9 +304,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, namespace_name: str, event_hub_name: str, **kwargs: Any
- ) -> None:
+ async def delete(self, resource_group_name: str, namespace_name: str, event_hub_name: str, **kwargs: Any) -> None:
"""Deletes an Event Hub from the specified Namespace and resource group.
.. seealso::
@@ -322,7 +320,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,
@@ -380,7 +378,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.EventHubResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -427,6 +425,7 @@ async def get(
def list_authorization_rules(
self, resource_group_name: str, namespace_name: str, event_hub_name: str, **kwargs: Any
) -> AsyncIterable["_models.SharedAccessAuthorizationRuleResource"]:
+ # pylint: disable=line-too-long
"""Gets the authorization rules for an Event Hub.
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -447,7 +446,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-08-01"))
cls: ClsType[_models.SharedAccessAuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -613,7 +612,7 @@ async def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.SharedAccessAuthorizationRuleResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -695,7 +694,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.SharedAccessAuthorizationRuleResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -765,7 +764,7 @@ async def post_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.SharedAccessAuthorizationRuleResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -810,7 +809,7 @@ async def post_authorization_rule(
return deserialized # type: ignore
@distributed_trace_async
- async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
+ async def delete_authorization_rule(
self,
resource_group_name: str,
namespace_name: str,
@@ -835,7 +834,7 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -901,7 +900,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.ResourceListKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1048,7 +1047,7 @@ async def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.ResourceListKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/operations/_namespaces_operations.py
index 803bb7eb41a16..940c00f209611 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/operations/_namespaces_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/operations/_namespaces_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, AsyncIterator, 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,6 +18,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -49,7 +51,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]]
@@ -124,7 +126,7 @@ async def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -191,7 +193,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Namespac
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-08-01"))
cls: ClsType[_models.NamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -270,7 +272,7 @@ def list_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-08-01"))
cls: ClsType[_models.NamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -338,7 +340,7 @@ async def _create_or_update_initial(
parameters: Union[_models.NamespaceCreateOrUpdateParameters, IO[bytes]],
**kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -374,6 +376,7 @@ async def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -382,18 +385,14 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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 = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -533,7 +532,7 @@ def get_long_running_output(pipeline_response):
async def _delete_initial(
self, resource_group_name: str, namespace_name: str, **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -557,6 +556,7 @@ async def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -565,18 +565,14 @@ async def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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 = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -648,7 +644,7 @@ async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.NamespaceResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -683,11 +679,7 @@ async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any
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("NamespaceResource", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("NamespaceResource", pipeline_response.http_response)
+ deserialized = self._deserialize("NamespaceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -770,7 +762,7 @@ async def update(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.NamespaceResource or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -818,11 +810,7 @@ async def update(
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("NamespaceResource", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("NamespaceResource", pipeline_response.http_response)
+ deserialized = self._deserialize("NamespaceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -833,6 +821,7 @@ async def update(
def list_authorization_rules(
self, resource_group_name: str, namespace_name: str, **kwargs: Any
) -> AsyncIterable["_models.SharedAccessAuthorizationRuleResource"]:
+ # pylint: disable=line-too-long
"""Gets a list of authorization rules for a Namespace.
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -851,7 +840,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-08-01"))
cls: ClsType[_models.SharedAccessAuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -998,7 +987,7 @@ async def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.SharedAccessAuthorizationRuleResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1054,7 +1043,7 @@ async def create_or_update_authorization_rule(
return deserialized # type: ignore
@distributed_trace_async
- async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
+ async def delete_authorization_rule(
self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any
) -> None:
"""Deletes an AuthorizationRule for a Namespace.
@@ -1069,7 +1058,7 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1124,7 +1113,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.SharedAccessAuthorizationRuleResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1183,7 +1172,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.ResourceListKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1308,7 +1297,7 @@ async def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.ResourceListKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/operations/_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/operations/_operations.py
index bdef31a75b414..6be7d3558ff18 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/aio/operations/_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_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
@@ -31,7 +30,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]]
@@ -71,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 "2015-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,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/models/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/models/__init__.py
index b4d7ffb3031eb..dfc635e63db75 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/models/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_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 CheckNameAvailabilityParameter
-from ._models_py3 import CheckNameAvailabilityResult
-from ._models_py3 import ConsumerGroupCreateOrUpdateParameters
-from ._models_py3 import ConsumerGroupListResult
-from ._models_py3 import ConsumerGroupResource
-from ._models_py3 import EventHubCreateOrUpdateParameters
-from ._models_py3 import EventHubListResult
-from ._models_py3 import EventHubResource
-from ._models_py3 import NamespaceCreateOrUpdateParameters
-from ._models_py3 import NamespaceListResult
-from ._models_py3 import NamespaceResource
-from ._models_py3 import NamespaceUpdateParameter
-from ._models_py3 import Operation
-from ._models_py3 import OperationDisplay
-from ._models_py3 import OperationListResult
-from ._models_py3 import RegenerateKeysParameters
-from ._models_py3 import Resource
-from ._models_py3 import ResourceListKeys
-from ._models_py3 import SharedAccessAuthorizationRuleCreateOrUpdateParameters
-from ._models_py3 import SharedAccessAuthorizationRuleListResult
-from ._models_py3 import SharedAccessAuthorizationRuleResource
-from ._models_py3 import Sku
-from ._models_py3 import TrackedResource
+from typing import TYPE_CHECKING
-from ._event_hub_management_client_enums import AccessRights
-from ._event_hub_management_client_enums import EntityStatus
-from ._event_hub_management_client_enums import NamespaceState
-from ._event_hub_management_client_enums import Policykey
-from ._event_hub_management_client_enums import SkuName
-from ._event_hub_management_client_enums import SkuTier
-from ._event_hub_management_client_enums import UnavailableReason
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ CheckNameAvailabilityParameter,
+ CheckNameAvailabilityResult,
+ ConsumerGroupCreateOrUpdateParameters,
+ ConsumerGroupListResult,
+ ConsumerGroupResource,
+ EventHubCreateOrUpdateParameters,
+ EventHubListResult,
+ EventHubResource,
+ NamespaceCreateOrUpdateParameters,
+ NamespaceListResult,
+ NamespaceResource,
+ NamespaceUpdateParameter,
+ Operation,
+ OperationDisplay,
+ OperationListResult,
+ RegenerateKeysParameters,
+ Resource,
+ ResourceListKeys,
+ SharedAccessAuthorizationRuleCreateOrUpdateParameters,
+ SharedAccessAuthorizationRuleListResult,
+ SharedAccessAuthorizationRuleResource,
+ Sku,
+ TrackedResource,
+)
+
+from ._event_hub_management_client_enums import ( # type: ignore
+ AccessRights,
+ EntityStatus,
+ NamespaceState,
+ Policykey,
+ SkuName,
+ SkuTier,
+ UnavailableReason,
+)
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 @@
"SkuTier",
"UnavailableReason",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/models/_models_py3.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/models/_models_py3.py
index 2ff341f670a47..cb3845159c6ef 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/models/_models_py3.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_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
@@ -667,7 +666,7 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s
self.tags = tags
-class NamespaceResource(TrackedResource): # pylint: disable=too-many-instance-attributes
+class NamespaceResource(TrackedResource):
"""Single Namespace item in List or Get Operation.
Variables are only populated by the server, and will be ignored when sending a request.
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/__init__.py
index 75a339ab21915..07c3019ad94f4 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_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 ._namespaces_operations import NamespacesOperations
-from ._event_hubs_operations import EventHubsOperations
-from ._consumer_groups_operations import ConsumerGroupsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._operations import Operations # type: ignore
+from ._namespaces_operations import NamespacesOperations # type: ignore
+from ._event_hubs_operations import EventHubsOperations # type: ignore
+from ._consumer_groups_operations import ConsumerGroupsOperations # 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 @@
"EventHubsOperations",
"ConsumerGroupsOperations",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/_consumer_groups_operations.py
index 6a453caba1055..a2dcf4c8b31d6 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/_consumer_groups_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/_consumer_groups_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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 (
@@ -32,7 +31,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -318,7 +317,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.ConsumerGroupResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -400,7 +399,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,
@@ -466,7 +465,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.ConsumerGroupResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -538,7 +537,7 @@ def list_all(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-08-01"))
cls: ClsType[_models.ConsumerGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/_event_hubs_operations.py
index 51200a5e751b0..7ec2fdecef30f 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/_event_hubs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/_event_hubs_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 (
@@ -32,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -501,7 +501,7 @@ def list_all(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-08-01"))
cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -655,7 +655,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.EventHubResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -729,7 +729,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,
@@ -787,7 +787,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.EventHubResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -854,7 +854,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-08-01"))
cls: ClsType[_models.SharedAccessAuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1020,7 +1020,7 @@ def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.SharedAccessAuthorizationRuleResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1102,7 +1102,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.SharedAccessAuthorizationRuleResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1172,7 +1172,7 @@ def post_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.SharedAccessAuthorizationRuleResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1242,7 +1242,7 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1308,7 +1308,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.ResourceListKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1455,7 +1455,7 @@ def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.ResourceListKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/_namespaces_operations.py
index 8c2a3930a1c10..221ff11e374e4 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/_namespaces_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/_namespaces_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, Iterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -540,7 +542,7 @@ def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -606,7 +608,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.NamespaceReso
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-08-01"))
cls: ClsType[_models.NamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -682,7 +684,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-08-01"))
cls: ClsType[_models.NamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -750,7 +752,7 @@ def _create_or_update_initial(
parameters: Union[_models.NamespaceCreateOrUpdateParameters, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -786,6 +788,7 @@ def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -794,18 +797,14 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- response.read() # Load the body in memory and close the socket
+ 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 = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -943,7 +942,7 @@ def get_long_running_output(pipeline_response):
)
def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -967,6 +966,7 @@ def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwarg
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -975,18 +975,14 @@ def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwarg
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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 = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1058,7 +1054,7 @@ def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.NamespaceResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1093,11 +1089,7 @@ def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _
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("NamespaceResource", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("NamespaceResource", pipeline_response.http_response)
+ deserialized = self._deserialize("NamespaceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1180,7 +1172,7 @@ def update(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.NamespaceResource or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1228,11 +1220,7 @@ def update(
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("NamespaceResource", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("NamespaceResource", pipeline_response.http_response)
+ deserialized = self._deserialize("NamespaceResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1261,7 +1249,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2015-08-01"))
cls: ClsType[_models.SharedAccessAuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1408,7 +1396,7 @@ def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.SharedAccessAuthorizationRuleResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1479,7 +1467,7 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1534,7 +1522,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.SharedAccessAuthorizationRuleResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1593,7 +1581,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.ResourceListKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1718,7 +1706,7 @@ def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2015_08_01.models.ResourceListKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/_operations.py
index 9877cde2a1e2b..9358b81f4fd2a 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_08_01/operations/_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2015_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 (
@@ -31,7 +30,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -92,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 "2015-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,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/__init__.py
index 7fb5add1ee3c8..2c8cfb26ae171 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_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 ._event_hub_management_client import EventHubManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._event_hub_management_client import EventHubManagementClient # 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__ = [
"EventHubManagementClient",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/_configuration.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/_configuration.py
index 3431fdb0945fe..b12b22efb1786 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/_configuration.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_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 EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+class EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for EventHubManagementClient.
Note that all parameters used to create this instance are saved as instance
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/_event_hub_management_client.py
index ec45fedd76596..41030a9efb1c5 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/_event_hub_management_client.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/_event_hub_management_client.py
@@ -28,11 +28,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class EventHubManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class EventHubManagementClient:
"""Azure Event Hubs client.
:ivar namespaces: NamespacesOperations operations
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/_version.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/_version.py
index 3767c560d3516..e5754a47ce68f 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/_version.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "11.1.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/__init__.py
index 699f917e93165..3cca02660c65c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_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 ._event_hub_management_client import EventHubManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._event_hub_management_client import EventHubManagementClient # 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__ = [
"EventHubManagementClient",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/_configuration.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/_configuration.py
index 17a52801344bf..43bfd8d994f35 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/_configuration.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_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 EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+class EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for EventHubManagementClient.
Note that all parameters used to create this instance are saved as instance
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/_event_hub_management_client.py
index d6ba1697965e4..702f259531967 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/_event_hub_management_client.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/_event_hub_management_client.py
@@ -28,11 +28,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class EventHubManagementClient: # pylint: disable=client-accepts-api-version-keyword
+class EventHubManagementClient:
"""Azure Event Hubs client.
:ivar namespaces: NamespacesOperations operations
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/__init__.py
index 8aacd88fffb40..4dc1eb12d5415 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_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 ._namespaces_operations import NamespacesOperations
-from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations
-from ._event_hubs_operations import EventHubsOperations
-from ._consumer_groups_operations import ConsumerGroupsOperations
-from ._operations import Operations
-from ._regions_operations import RegionsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._namespaces_operations import NamespacesOperations # type: ignore
+from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations # type: ignore
+from ._event_hubs_operations import EventHubsOperations # type: ignore
+from ._consumer_groups_operations import ConsumerGroupsOperations # type: ignore
+from ._operations import Operations # type: ignore
+from ._regions_operations import RegionsOperations # 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 @@
"Operations",
"RegionsOperations",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_consumer_groups_operations.py
index 06d4f980b4204..2ab19ed9f73c1 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_consumer_groups_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_consumer_groups_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -38,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]]
@@ -154,7 +153,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -212,7 +211,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,
namespace_name: str,
@@ -234,7 +233,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,
@@ -298,7 +297,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -380,7 +379,7 @@ def list_by_event_hub(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-04-01"))
cls: ClsType[_models.ConsumerGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_disaster_recovery_configs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_disaster_recovery_configs_operations.py
index 52b92f57f7fdb..69c8178c06320 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_disaster_recovery_configs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_disaster_recovery_configs_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -44,7 +43,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 +91,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-04-01"))
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -174,7 +173,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -237,7 +236,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -356,7 +355,7 @@ async def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -432,7 +431,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-04-01"))
cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -579,7 +578,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.ArmDisasterRecovery or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -638,9 +637,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, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def delete(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""Deletes an Alias(Disaster Recovery configuration).
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -653,7 +650,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,
@@ -709,7 +706,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -754,9 +751,7 @@ async def get(
return deserialized # type: ignore
@distributed_trace_async
- async def break_pairing( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def break_pairing(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""This operation disables the Disaster Recovery and stops replicating changes from primary to
secondary namespaces.
@@ -770,7 +765,7 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -811,9 +806,7 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements
return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def fail_over( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def fail_over(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace.
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -826,7 +819,7 @@ async def fail_over( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_event_hubs_operations.py
index 8d4a7ecc30489..fb72e9bed22cf 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_event_hubs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_event_hubs_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
@@ -44,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]]
@@ -92,7 +92,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-04-01"))
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -250,7 +250,7 @@ async def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -330,7 +330,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -376,7 +376,7 @@ async def get_authorization_rule(
return deserialized # type: ignore
@distributed_trace_async
- async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
+ async def delete_authorization_rule(
self,
resource_group_name: str,
namespace_name: str,
@@ -398,7 +398,7 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -462,7 +462,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -602,7 +602,7 @@ async def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -692,7 +692,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-04-01"))
cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -839,7 +839,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -896,9 +896,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, namespace_name: str, event_hub_name: str, **kwargs: Any
- ) -> None:
+ async def delete(self, resource_group_name: str, namespace_name: str, event_hub_name: str, **kwargs: Any) -> None:
"""Deletes an Event Hub from the specified Namespace and resource group.
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -911,7 +909,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,
@@ -967,7 +965,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_namespaces_operations.py
index 084145017feed..cd45803bb7222 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_namespaces_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_namespaces_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, AsyncIterator, 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,6 +18,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -53,7 +55,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]]
@@ -99,7 +101,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-04-01"))
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -244,7 +246,7 @@ async def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -301,7 +303,7 @@ async def create_or_update_authorization_rule(
return deserialized # type: ignore
@distributed_trace_async
- async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
+ async def delete_authorization_rule(
self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any
) -> None:
"""Deletes an AuthorizationRule for a Namespace.
@@ -316,7 +318,7 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -372,7 +374,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -432,7 +434,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -559,7 +561,7 @@ async def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -665,7 +667,7 @@ async def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -733,7 +735,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.EHNamespace"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-04-01"))
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -811,7 +813,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-04-01"))
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -880,7 +882,7 @@ async def _create_or_update_initial(
parameters: Union[_models.EHNamespace, IO[bytes]],
**kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -916,6 +918,7 @@ async def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -924,19 +927,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1072,7 +1071,7 @@ def get_long_running_output(pipeline_response):
async def _delete_initial(
self, resource_group_name: str, namespace_name: str, **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1096,6 +1095,7 @@ async def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -1104,19 +1104,15 @@ async def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1188,7 +1184,7 @@ async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.EHNamespace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1224,11 +1220,7 @@ async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any
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("EHNamespace", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
+ deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1311,7 +1303,7 @@ async def update(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.EHNamespace or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1360,11 +1352,7 @@ async def update(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
+ deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1385,7 +1373,7 @@ async def get_messaging_plan(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.MessagingPlan
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1501,7 +1489,7 @@ async def create_or_update_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1570,7 +1558,7 @@ async def get_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1634,7 +1622,7 @@ def list_network_rule_sets(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-04-01"))
cls: ClsType[_models.NetworkRuleSetListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_operations.py
index c0c2d4976e1dd..4fd93812339ff 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_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
@@ -31,7 +30,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]]
@@ -71,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-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,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_regions_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_regions_operations.py
index 377ed51a538a8..1fbe25a009c61 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_regions_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/aio/operations/_regions_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
@@ -31,7 +30,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]]
@@ -73,7 +72,7 @@ def list_by_sku(self, sku: str, **kwargs: Any) -> AsyncIterable["_models.Messagi
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-04-01"))
cls: ClsType[_models.MessagingRegionsListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/__init__.py
index 0357b940055c6..04aad08c5ec0b 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/__init__.py
@@ -5,53 +5,64 @@
# 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 AccessKeys
-from ._models_py3 import ArmDisasterRecovery
-from ._models_py3 import ArmDisasterRecoveryListResult
-from ._models_py3 import AuthorizationRule
-from ._models_py3 import AuthorizationRuleListResult
-from ._models_py3 import CaptureDescription
-from ._models_py3 import CheckNameAvailabilityParameter
-from ._models_py3 import CheckNameAvailabilityResult
-from ._models_py3 import ConsumerGroup
-from ._models_py3 import ConsumerGroupListResult
-from ._models_py3 import Destination
-from ._models_py3 import EHNamespace
-from ._models_py3 import EHNamespaceListResult
-from ._models_py3 import ErrorResponse
-from ._models_py3 import EventHubListResult
-from ._models_py3 import Eventhub
-from ._models_py3 import MessagingPlan
-from ._models_py3 import MessagingRegions
-from ._models_py3 import MessagingRegionsListResult
-from ._models_py3 import MessagingRegionsProperties
-from ._models_py3 import NWRuleSetIpRules
-from ._models_py3 import NWRuleSetVirtualNetworkRules
-from ._models_py3 import NetworkRuleSet
-from ._models_py3 import NetworkRuleSetListResult
-from ._models_py3 import Operation
-from ._models_py3 import OperationDisplay
-from ._models_py3 import OperationListResult
-from ._models_py3 import RegenerateAccessKeyParameters
-from ._models_py3 import Resource
-from ._models_py3 import Sku
-from ._models_py3 import Subnet
-from ._models_py3 import TrackedResource
+from typing import TYPE_CHECKING
-from ._event_hub_management_client_enums import AccessRights
-from ._event_hub_management_client_enums import DefaultAction
-from ._event_hub_management_client_enums import EncodingCaptureDescription
-from ._event_hub_management_client_enums import EntityStatus
-from ._event_hub_management_client_enums import KeyType
-from ._event_hub_management_client_enums import NetworkRuleIPAction
-from ._event_hub_management_client_enums import ProvisioningStateDR
-from ._event_hub_management_client_enums import RoleDisasterRecovery
-from ._event_hub_management_client_enums import SkuName
-from ._event_hub_management_client_enums import SkuTier
-from ._event_hub_management_client_enums import UnavailableReason
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ AccessKeys,
+ ArmDisasterRecovery,
+ ArmDisasterRecoveryListResult,
+ AuthorizationRule,
+ AuthorizationRuleListResult,
+ CaptureDescription,
+ CheckNameAvailabilityParameter,
+ CheckNameAvailabilityResult,
+ ConsumerGroup,
+ ConsumerGroupListResult,
+ Destination,
+ EHNamespace,
+ EHNamespaceListResult,
+ ErrorResponse,
+ EventHubListResult,
+ Eventhub,
+ MessagingPlan,
+ MessagingRegions,
+ MessagingRegionsListResult,
+ MessagingRegionsProperties,
+ NWRuleSetIpRules,
+ NWRuleSetVirtualNetworkRules,
+ NetworkRuleSet,
+ NetworkRuleSetListResult,
+ Operation,
+ OperationDisplay,
+ OperationListResult,
+ RegenerateAccessKeyParameters,
+ Resource,
+ Sku,
+ Subnet,
+ TrackedResource,
+)
+
+from ._event_hub_management_client_enums import ( # type: ignore
+ AccessRights,
+ DefaultAction,
+ EncodingCaptureDescription,
+ EntityStatus,
+ KeyType,
+ NetworkRuleIPAction,
+ ProvisioningStateDR,
+ RoleDisasterRecovery,
+ SkuName,
+ SkuTier,
+ UnavailableReason,
+)
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__ = [
@@ -99,5 +110,5 @@
"SkuTier",
"UnavailableReason",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_models_py3.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_models_py3.py
index cda76bc853edc..c0d7279447c0f 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/models/_models_py3.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_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.
@@ -12,7 +12,6 @@
from ... import _serialization
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -610,7 +609,7 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s
self.tags = tags
-class EHNamespace(TrackedResource): # pylint: disable=too-many-instance-attributes
+class EHNamespace(TrackedResource):
"""Single Namespace item in List or Get Operation.
Variables are only populated by the server, and will be ignored when sending a request.
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/__init__.py
index 8aacd88fffb40..4dc1eb12d5415 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_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 ._namespaces_operations import NamespacesOperations
-from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations
-from ._event_hubs_operations import EventHubsOperations
-from ._consumer_groups_operations import ConsumerGroupsOperations
-from ._operations import Operations
-from ._regions_operations import RegionsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._namespaces_operations import NamespacesOperations # type: ignore
+from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations # type: ignore
+from ._event_hubs_operations import EventHubsOperations # type: ignore
+from ._consumer_groups_operations import ConsumerGroupsOperations # type: ignore
+from ._operations import Operations # type: ignore
+from ._regions_operations import RegionsOperations # 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 @@
"Operations",
"RegionsOperations",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_consumer_groups_operations.py
index 16cdaeacf3221..e2c2acaa83d32 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_consumer_groups_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_consumer_groups_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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 (
@@ -32,7 +31,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -353,7 +352,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -433,7 +432,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,
@@ -497,7 +496,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -578,7 +577,7 @@ def list_by_event_hub(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-04-01"))
cls: ClsType[_models.ConsumerGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_disaster_recovery_configs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_disaster_recovery_configs_operations.py
index 1037e3360b4b7..4dff0274c6c56 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_disaster_recovery_configs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_disaster_recovery_configs_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 (
@@ -32,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -512,7 +512,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-04-01"))
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -594,7 +594,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -657,7 +657,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -776,7 +776,7 @@ def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -852,7 +852,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-04-01"))
cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -999,7 +999,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.ArmDisasterRecovery or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1073,7 +1073,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,
@@ -1129,7 +1129,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1190,7 +1190,7 @@ def break_pairing( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1246,7 +1246,7 @@ def fail_over( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_event_hubs_operations.py
index e8737b0aaa475..a48bf9dc570d1 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_event_hubs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_event_hubs_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 (
@@ -32,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -550,7 +550,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-04-01"))
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -708,7 +708,7 @@ def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -788,7 +788,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -856,7 +856,7 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -920,7 +920,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1060,7 +1060,7 @@ def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1149,7 +1149,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-04-01"))
cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1296,7 +1296,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1368,7 +1368,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,
@@ -1424,7 +1424,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_namespaces_operations.py
index 80c01144e7beb..ec0eeaec29bd8 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_namespaces_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_namespaces_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, Iterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -755,7 +757,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-04-01"))
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -900,7 +902,7 @@ def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -972,7 +974,7 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1028,7 +1030,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1088,7 +1090,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1215,7 +1217,7 @@ def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1321,7 +1323,7 @@ def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1388,7 +1390,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.EHNamespace"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-04-01"))
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1465,7 +1467,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-04-01"))
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1534,7 +1536,7 @@ def _create_or_update_initial(
parameters: Union[_models.EHNamespace, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1570,6 +1572,7 @@ def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -1578,19 +1581,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1724,7 +1723,7 @@ def get_long_running_output(pipeline_response):
)
def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1748,6 +1747,7 @@ def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwarg
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -1756,19 +1756,15 @@ def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwarg
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1840,7 +1836,7 @@ def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.EHNamespace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1876,11 +1872,7 @@ def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _
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("EHNamespace", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
+ deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1963,7 +1955,7 @@ def update(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.EHNamespace or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2012,11 +2004,7 @@ def update(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
+ deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -2035,7 +2023,7 @@ def get_messaging_plan(self, resource_group_name: str, namespace_name: str, **kw
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.MessagingPlan
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2151,7 +2139,7 @@ def create_or_update_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2220,7 +2208,7 @@ def get_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2017_04_01.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2283,7 +2271,7 @@ def list_network_rule_sets(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-04-01"))
cls: ClsType[_models.NetworkRuleSetListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_operations.py
index 93a7279bcd955..fe3f64085fa12 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_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 (
@@ -31,7 +30,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -92,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-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,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_regions_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_regions_operations.py
index b8fef68fbf3de..5e48c2ccfb758 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_regions_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2017_04_01/operations/_regions_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 (
@@ -31,7 +30,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -100,7 +99,7 @@ def list_by_sku(self, sku: str, **kwargs: Any) -> Iterable["_models.MessagingReg
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-04-01"))
cls: ClsType[_models.MessagingRegionsListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/__init__.py
index 7fb5add1ee3c8..2c8cfb26ae171 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_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 ._event_hub_management_client import EventHubManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._event_hub_management_client import EventHubManagementClient # 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__ = [
"EventHubManagementClient",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_configuration.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_configuration.py
index 186383b64fff9..e2660235c322b 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_configuration.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_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 EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+class EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for EventHubManagementClient.
Note that all parameters used to create this instance are saved as instance
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_event_hub_management_client.py
index f51c950954e06..ebc64561142f2 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_event_hub_management_client.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_event_hub_management_client.py
@@ -32,11 +32,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class EventHubManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class EventHubManagementClient: # pylint: disable=too-many-instance-attributes
"""Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules
resources.
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_version.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_version.py
index 3767c560d3516..e5754a47ce68f 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_version.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "11.1.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/__init__.py
index 699f917e93165..3cca02660c65c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_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 ._event_hub_management_client import EventHubManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._event_hub_management_client import EventHubManagementClient # 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__ = [
"EventHubManagementClient",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/_configuration.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/_configuration.py
index 0de1abc8829d1..778faec2b2454 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/_configuration.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_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 EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+class EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for EventHubManagementClient.
Note that all parameters used to create this instance are saved as instance
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/_event_hub_management_client.py
index c6b94431ab99a..3203398422edb 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/_event_hub_management_client.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/_event_hub_management_client.py
@@ -32,11 +32,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class EventHubManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class EventHubManagementClient: # pylint: disable=too-many-instance-attributes
"""Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules
resources.
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/__init__.py
index 1821363f32fd5..d8db7be8298bc 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/__init__.py
@@ -5,20 +5,26 @@
# 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 ._clusters_operations import ClustersOperations
-from ._namespaces_operations import NamespacesOperations
-from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
-from ._private_link_resources_operations import PrivateLinkResourcesOperations
-from ._configuration_operations import ConfigurationOperations
-from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations
-from ._event_hubs_operations import EventHubsOperations
-from ._consumer_groups_operations import ConsumerGroupsOperations
-from ._operations import Operations
-from ._regions_operations import RegionsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._clusters_operations import ClustersOperations # type: ignore
+from ._namespaces_operations import NamespacesOperations # type: ignore
+from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore
+from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore
+from ._configuration_operations import ConfigurationOperations # type: ignore
+from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations # type: ignore
+from ._event_hubs_operations import EventHubsOperations # type: ignore
+from ._consumer_groups_operations import ConsumerGroupsOperations # type: ignore
+from ._operations import Operations # type: ignore
+from ._regions_operations import RegionsOperations # 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__ = [
@@ -33,5 +39,5 @@
"Operations",
"RegionsOperations",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_clusters_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_clusters_operations.py
index 3dc16c80fb6c2..ef82e99687eaa 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_clusters_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_clusters_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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, AsyncIterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -43,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]]
@@ -76,7 +77,7 @@ async def list_available_cluster_region(self, **kwargs: Any) -> _models.Availabl
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AvailableClustersList
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -138,7 +139,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy
)
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -212,7 +213,7 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any)
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.Cluster
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -260,7 +261,7 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any)
async def _create_or_update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -298,6 +299,7 @@ async def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -306,19 +308,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -452,7 +450,7 @@ def get_long_running_output(pipeline_response):
async def _update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -490,6 +488,7 @@ async def _update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -498,19 +497,15 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -642,7 +637,7 @@ def get_long_running_output(pipeline_response):
)
async def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -668,6 +663,7 @@ async def _delete_initial(self, resource_group_name: str, cluster_name: str, **k
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -676,19 +672,15 @@ async def _delete_initial(self, resource_group_name: str, cluster_name: str, **k
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -763,7 +755,7 @@ async def list_namespaces(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.EHNamespaceIdListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_configuration_operations.py
index b272f487cb08f..30c86073993f1 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_configuration_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_configuration_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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,
@@ -30,7 +29,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 +136,7 @@ async def patch(
None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -188,11 +187,7 @@ async def patch(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
+ deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -214,7 +209,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.ClusterQuotaConfigurationProperties
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_consumer_groups_operations.py
index e899fec6bd1cf..d3cf7be6dc1d3 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_consumer_groups_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_consumer_groups_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -38,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]]
@@ -154,7 +153,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -214,7 +213,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,
namespace_name: str,
@@ -236,7 +235,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 +301,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -388,7 +387,7 @@ def list_by_event_hub(
)
cls: ClsType[_models.ConsumerGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py
index 47a4b214d8254..c87d92be20b9a 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -44,7 +43,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]]
@@ -94,7 +93,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -176,7 +175,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -241,7 +240,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -363,7 +362,7 @@ async def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -443,7 +442,7 @@ def list(
)
cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -591,7 +590,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.ArmDisasterRecovery or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -652,9 +651,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, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def delete(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""Deletes an Alias(Disaster Recovery configuration).
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -667,7 +664,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,
@@ -725,7 +722,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -772,9 +769,7 @@ async def get(
return deserialized # type: ignore
@distributed_trace_async
- async def break_pairing( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def break_pairing(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""This operation disables the Disaster Recovery and stops replicating changes from primary to
secondary namespaces.
@@ -788,7 +783,7 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -831,9 +826,7 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements
return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def fail_over( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def fail_over(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace.
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -846,7 +839,7 @@ async def fail_over( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_event_hubs_operations.py
index 6c0e81f881e21..24fa4f095a788 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_event_hubs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_event_hubs_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
@@ -44,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]]
@@ -94,7 +94,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -253,7 +253,7 @@ async def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -335,7 +335,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -383,7 +383,7 @@ async def get_authorization_rule(
return deserialized # type: ignore
@distributed_trace_async
- async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
+ async def delete_authorization_rule(
self,
resource_group_name: str,
namespace_name: str,
@@ -405,7 +405,7 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -471,7 +471,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -613,7 +613,7 @@ async def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -707,7 +707,7 @@ def list_by_namespace(
)
cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -854,7 +854,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -913,9 +913,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, namespace_name: str, event_hub_name: str, **kwargs: Any
- ) -> None:
+ async def delete(self, resource_group_name: str, namespace_name: str, event_hub_name: str, **kwargs: Any) -> None:
"""Deletes an Event Hub from the specified Namespace and resource group.
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -928,7 +926,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,
@@ -986,7 +984,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_namespaces_operations.py
index b9a581169c8ab..8c94be37fb1c5 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_namespaces_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_namespaces_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, AsyncIterator, 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,6 +18,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -59,7 +61,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]]
@@ -107,7 +109,7 @@ def list_ip_filter_rules(
)
cls: ClsType[_models.IpFilterRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -252,7 +254,7 @@ async def create_or_update_ip_filter_rule(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.IpFilterRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -311,7 +313,7 @@ async def create_or_update_ip_filter_rule(
return deserialized # type: ignore
@distributed_trace_async
- async def delete_ip_filter_rule( # pylint: disable=inconsistent-return-statements
+ async def delete_ip_filter_rule(
self, resource_group_name: str, namespace_name: str, ip_filter_rule_name: str, **kwargs: Any
) -> None:
"""Deletes an IpFilterRule for a Namespace.
@@ -326,7 +328,7 @@ async def delete_ip_filter_rule( # 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,
@@ -384,7 +386,7 @@ async def get_ip_filter_rule(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.IpFilterRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -447,7 +449,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.EHNamespace"]:
)
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -527,7 +529,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy
)
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -596,7 +598,7 @@ async def _create_or_update_initial(
parameters: Union[_models.EHNamespace, IO[bytes]],
**kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -634,6 +636,7 @@ async def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -642,19 +645,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -795,7 +794,7 @@ def get_long_running_output(pipeline_response):
async def _delete_initial(
self, resource_group_name: str, namespace_name: str, **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -821,6 +820,7 @@ async def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -829,19 +829,15 @@ async def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -915,7 +911,7 @@ async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.EHNamespace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -953,11 +949,7 @@ async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any
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("EHNamespace", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
+ deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1040,7 +1032,7 @@ async def update(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.EHNamespace or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1091,11 +1083,7 @@ async def update(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
+ deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1125,7 +1113,7 @@ def list_virtual_network_rules(
)
cls: ClsType[_models.VirtualNetworkRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1271,7 +1259,7 @@ async def create_or_update_virtual_network_rule(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.VirtualNetworkRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1330,7 +1318,7 @@ async def create_or_update_virtual_network_rule(
return deserialized # type: ignore
@distributed_trace_async
- async def delete_virtual_network_rule( # pylint: disable=inconsistent-return-statements
+ async def delete_virtual_network_rule(
self, resource_group_name: str, namespace_name: str, virtual_network_rule_name: str, **kwargs: Any
) -> None:
"""Deletes an VirtualNetworkRule for a Namespace.
@@ -1345,7 +1333,7 @@ async def delete_virtual_network_rule( # 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,
@@ -1403,7 +1391,7 @@ async def get_virtual_network_rule(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.VirtualNetworkRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1522,7 +1510,7 @@ async def create_or_update_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1593,7 +1581,7 @@ async def get_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1661,7 +1649,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1807,7 +1795,7 @@ async def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1866,7 +1854,7 @@ async def create_or_update_authorization_rule(
return deserialized # type: ignore
@distributed_trace_async
- async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
+ async def delete_authorization_rule(
self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any
) -> None:
"""Deletes an AuthorizationRule for a Namespace.
@@ -1881,7 +1869,7 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1939,7 +1927,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2001,7 +1989,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2130,7 +2118,7 @@ async def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2239,7 +2227,7 @@ async def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_operations.py
index 92d88be25d706..fd3fd8ca08857 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_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
@@ -31,7 +30,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]]
@@ -73,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,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_private_endpoint_connections_operations.py
index 9e6d78b9e5ebd..c1db14affd2fd 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_private_endpoint_connections_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_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, AsyncIterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -40,7 +41,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 +70,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, resource_group_name: str, namespace_name: str, **kwargs: Any
) -> AsyncIterable["_models.PrivateEndpointConnection"]:
+ # pylint: disable=line-too-long
"""Gets the available PrivateEndpointConnections within a namespace.
.. seealso::
@@ -92,7 +94,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,
@@ -249,7 +251,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -300,11 +302,7 @@ async def create_or_update(
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("PrivateEndpointConnection", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -314,7 +312,7 @@ async def create_or_update(
async def _delete_initial(
self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -341,6 +339,7 @@ async def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -349,19 +348,15 @@ async def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -450,7 +445,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_private_link_resources_operations.py
index 771228f446d4a..06d68f625fa7b 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_private_link_resources_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_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,
@@ -29,7 +28,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]]
@@ -71,7 +70,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.PrivateLinkResourcesListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_regions_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_regions_operations.py
index 2c4324bee34ea..de66addf53e6b 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_regions_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/aio/operations/_regions_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
@@ -31,7 +30,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,7 +74,7 @@ def list_by_sku(self, sku: str, **kwargs: Any) -> AsyncIterable["_models.Messagi
)
cls: ClsType[_models.MessagingRegionsListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/__init__.py
index 7cf56acf8fe37..c1d8e97357be6 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/__init__.py
@@ -5,76 +5,87 @@
# 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 AccessKeys
-from ._models_py3 import ArmDisasterRecovery
-from ._models_py3 import ArmDisasterRecoveryListResult
-from ._models_py3 import AuthorizationRule
-from ._models_py3 import AuthorizationRuleListResult
-from ._models_py3 import AvailableCluster
-from ._models_py3 import AvailableClustersList
-from ._models_py3 import CaptureDescription
-from ._models_py3 import CheckNameAvailabilityParameter
-from ._models_py3 import CheckNameAvailabilityResult
-from ._models_py3 import Cluster
-from ._models_py3 import ClusterListResult
-from ._models_py3 import ClusterQuotaConfigurationProperties
-from ._models_py3 import ClusterSku
-from ._models_py3 import ConnectionState
-from ._models_py3 import ConsumerGroup
-from ._models_py3 import ConsumerGroupListResult
-from ._models_py3 import Destination
-from ._models_py3 import EHNamespace
-from ._models_py3 import EHNamespaceIdContainer
-from ._models_py3 import EHNamespaceIdListResult
-from ._models_py3 import EHNamespaceListResult
-from ._models_py3 import Encryption
-from ._models_py3 import ErrorResponse
-from ._models_py3 import EventHubListResult
-from ._models_py3 import Eventhub
-from ._models_py3 import Identity
-from ._models_py3 import IpFilterRule
-from ._models_py3 import IpFilterRuleListResult
-from ._models_py3 import KeyVaultProperties
-from ._models_py3 import MessagingRegions
-from ._models_py3 import MessagingRegionsListResult
-from ._models_py3 import MessagingRegionsProperties
-from ._models_py3 import NWRuleSetIpRules
-from ._models_py3 import NWRuleSetVirtualNetworkRules
-from ._models_py3 import NetworkRuleSet
-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 PrivateLinkResourcesListResult
-from ._models_py3 import RegenerateAccessKeyParameters
-from ._models_py3 import Resource
-from ._models_py3 import Sku
-from ._models_py3 import Subnet
-from ._models_py3 import TrackedResource
-from ._models_py3 import VirtualNetworkRule
-from ._models_py3 import VirtualNetworkRuleListResult
+from typing import TYPE_CHECKING
-from ._event_hub_management_client_enums import AccessRights
-from ._event_hub_management_client_enums import ClusterSkuName
-from ._event_hub_management_client_enums import DefaultAction
-from ._event_hub_management_client_enums import EncodingCaptureDescription
-from ._event_hub_management_client_enums import EndPointProvisioningState
-from ._event_hub_management_client_enums import EntityStatus
-from ._event_hub_management_client_enums import IPAction
-from ._event_hub_management_client_enums import KeyType
-from ._event_hub_management_client_enums import NetworkRuleIPAction
-from ._event_hub_management_client_enums import PrivateLinkConnectionStatus
-from ._event_hub_management_client_enums import ProvisioningStateDR
-from ._event_hub_management_client_enums import RoleDisasterRecovery
-from ._event_hub_management_client_enums import SkuName
-from ._event_hub_management_client_enums import SkuTier
-from ._event_hub_management_client_enums import UnavailableReason
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ AccessKeys,
+ ArmDisasterRecovery,
+ ArmDisasterRecoveryListResult,
+ AuthorizationRule,
+ AuthorizationRuleListResult,
+ AvailableCluster,
+ AvailableClustersList,
+ CaptureDescription,
+ CheckNameAvailabilityParameter,
+ CheckNameAvailabilityResult,
+ Cluster,
+ ClusterListResult,
+ ClusterQuotaConfigurationProperties,
+ ClusterSku,
+ ConnectionState,
+ ConsumerGroup,
+ ConsumerGroupListResult,
+ Destination,
+ EHNamespace,
+ EHNamespaceIdContainer,
+ EHNamespaceIdListResult,
+ EHNamespaceListResult,
+ Encryption,
+ ErrorResponse,
+ EventHubListResult,
+ Eventhub,
+ Identity,
+ IpFilterRule,
+ IpFilterRuleListResult,
+ KeyVaultProperties,
+ MessagingRegions,
+ MessagingRegionsListResult,
+ MessagingRegionsProperties,
+ NWRuleSetIpRules,
+ NWRuleSetVirtualNetworkRules,
+ NetworkRuleSet,
+ Operation,
+ OperationDisplay,
+ OperationListResult,
+ PrivateEndpoint,
+ PrivateEndpointConnection,
+ PrivateEndpointConnectionListResult,
+ PrivateLinkResource,
+ PrivateLinkResourcesListResult,
+ RegenerateAccessKeyParameters,
+ Resource,
+ Sku,
+ Subnet,
+ TrackedResource,
+ VirtualNetworkRule,
+ VirtualNetworkRuleListResult,
+)
+
+from ._event_hub_management_client_enums import ( # type: ignore
+ AccessRights,
+ ClusterSkuName,
+ DefaultAction,
+ EncodingCaptureDescription,
+ EndPointProvisioningState,
+ EntityStatus,
+ IPAction,
+ KeyType,
+ NetworkRuleIPAction,
+ PrivateLinkConnectionStatus,
+ ProvisioningStateDR,
+ RoleDisasterRecovery,
+ SkuName,
+ SkuTier,
+ UnavailableReason,
+)
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__ = [
@@ -145,5 +156,5 @@
"SkuTier",
"UnavailableReason",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_models_py3.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_models_py3.py
index 8b1384fca0204..b8a594067956b 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/models/_models_py3.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_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.
@@ -12,7 +12,6 @@
from ... import _serialization
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
@@ -854,7 +853,7 @@ def __init__(
self.archive_name_format = archive_name_format
-class EHNamespace(TrackedResource): # pylint: disable=too-many-instance-attributes
+class EHNamespace(TrackedResource):
"""Single Namespace item in List or Get Operation.
Variables are only populated by the server, and will be ignored when sending a request.
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/__init__.py
index 1821363f32fd5..d8db7be8298bc 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/__init__.py
@@ -5,20 +5,26 @@
# 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 ._clusters_operations import ClustersOperations
-from ._namespaces_operations import NamespacesOperations
-from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
-from ._private_link_resources_operations import PrivateLinkResourcesOperations
-from ._configuration_operations import ConfigurationOperations
-from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations
-from ._event_hubs_operations import EventHubsOperations
-from ._consumer_groups_operations import ConsumerGroupsOperations
-from ._operations import Operations
-from ._regions_operations import RegionsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._clusters_operations import ClustersOperations # type: ignore
+from ._namespaces_operations import NamespacesOperations # type: ignore
+from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore
+from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore
+from ._configuration_operations import ConfigurationOperations # type: ignore
+from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations # type: ignore
+from ._event_hubs_operations import EventHubsOperations # type: ignore
+from ._consumer_groups_operations import ConsumerGroupsOperations # type: ignore
+from ._operations import Operations # type: ignore
+from ._regions_operations import RegionsOperations # 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__ = [
@@ -33,5 +39,5 @@
"Operations",
"RegionsOperations",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_clusters_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_clusters_operations.py
index 7eb20be4db0be..747845a78686e 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_clusters_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_clusters_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, Iterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -297,7 +299,7 @@ def list_available_cluster_region(self, **kwargs: Any) -> _models.AvailableClust
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AvailableClustersList
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -358,7 +360,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite
)
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -432,7 +434,7 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.Cluster
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -480,7 +482,7 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo
def _create_or_update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -518,6 +520,7 @@ def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -526,19 +529,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -666,7 +665,7 @@ def get_long_running_output(pipeline_response):
def _update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -704,6 +703,7 @@ def _update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -712,19 +712,15 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -850,7 +846,7 @@ def get_long_running_output(pipeline_response):
)
def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -876,6 +872,7 @@ def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs:
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -884,19 +881,15 @@ def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs:
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -971,7 +964,7 @@ def list_namespaces(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.EHNamespaceIdListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_configuration_operations.py
index d32dec5d4dd58..0e19fe57afbe7 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_configuration_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_configuration_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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,
@@ -30,7 +29,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -207,7 +206,7 @@ def patch(
None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -258,11 +257,7 @@ def patch(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
+ deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -284,7 +279,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.ClusterQuotaConfigurationProperties
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_consumer_groups_operations.py
index fe9f0515f7777..4bb874ee404a6 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_consumer_groups_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_consumer_groups_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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 (
@@ -32,7 +31,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -353,7 +352,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -435,7 +434,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,
@@ -501,7 +500,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -587,7 +586,7 @@ def list_by_event_hub(
)
cls: ClsType[_models.ConsumerGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_disaster_recovery_configs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_disaster_recovery_configs_operations.py
index 73dac0f23dcd6..94dde8ced1da4 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_disaster_recovery_configs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_disaster_recovery_configs_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 (
@@ -32,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -515,7 +515,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -597,7 +597,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -662,7 +662,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -784,7 +784,7 @@ def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -864,7 +864,7 @@ def list(
)
cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1012,7 +1012,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.ArmDisasterRecovery or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1088,7 +1088,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,
@@ -1146,7 +1146,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1209,7 +1209,7 @@ def break_pairing( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1267,7 +1267,7 @@ def fail_over( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_event_hubs_operations.py
index 7e987ef05e733..95ee2aa89eb2c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_event_hubs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_event_hubs_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 (
@@ -32,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -553,7 +553,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -712,7 +712,7 @@ def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -794,7 +794,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -864,7 +864,7 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -930,7 +930,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1072,7 +1072,7 @@ def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1165,7 +1165,7 @@ def list_by_namespace(
)
cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1312,7 +1312,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1386,7 +1386,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,
@@ -1444,7 +1444,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_namespaces_operations.py
index 5c0766aa2c66c..81b7fdf7451d8 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_namespaces_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_namespaces_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, Iterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -1016,7 +1018,7 @@ def list_ip_filter_rules(
)
cls: ClsType[_models.IpFilterRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1161,7 +1163,7 @@ def create_or_update_ip_filter_rule(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.IpFilterRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1235,7 +1237,7 @@ def delete_ip_filter_rule( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1293,7 +1295,7 @@ def get_ip_filter_rule(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.IpFilterRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1356,7 +1358,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.EHNamespace"]:
)
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1436,7 +1438,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite
)
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1505,7 +1507,7 @@ def _create_or_update_initial(
parameters: Union[_models.EHNamespace, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1543,6 +1545,7 @@ def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -1551,19 +1554,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1702,7 +1701,7 @@ def get_long_running_output(pipeline_response):
)
def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1728,6 +1727,7 @@ def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwarg
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -1736,19 +1736,15 @@ def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwarg
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1822,7 +1818,7 @@ def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.EHNamespace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1860,11 +1856,7 @@ def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _
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("EHNamespace", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
+ deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1947,7 +1939,7 @@ def update(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.EHNamespace or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1998,11 +1990,7 @@ def update(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
+ deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -2032,7 +2020,7 @@ def list_virtual_network_rules(
)
cls: ClsType[_models.VirtualNetworkRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2178,7 +2166,7 @@ def create_or_update_virtual_network_rule(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.VirtualNetworkRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2252,7 +2240,7 @@ def delete_virtual_network_rule( # 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,
@@ -2310,7 +2298,7 @@ def get_virtual_network_rule(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.VirtualNetworkRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2429,7 +2417,7 @@ def create_or_update_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2500,7 +2488,7 @@ def get_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2568,7 +2556,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2714,7 +2702,7 @@ def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2788,7 +2776,7 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2846,7 +2834,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2908,7 +2896,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -3037,7 +3025,7 @@ def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -3146,7 +3134,7 @@ def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_operations.py
index d1841a5777b2e..2f6f6e374d118 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_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 (
@@ -31,7 +30,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -94,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,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_private_endpoint_connections_operations.py
index 7ba1866c11c2c..65a2dc2e15b82 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_private_endpoint_connections_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_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, Iterator, 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,6 +16,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,7 +35,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -273,7 +274,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,
@@ -430,7 +431,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -481,11 +482,7 @@ def create_or_update(
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("PrivateEndpointConnection", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -495,7 +492,7 @@ def create_or_update(
def _delete_initial(
self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -522,6 +519,7 @@ def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -530,19 +528,15 @@ def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -631,7 +625,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_private_link_resources_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_private_link_resources_operations.py
index 41ae83a4afdd3..22572d97aae02 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_private_link_resources_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_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,
@@ -29,7 +28,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -114,7 +113,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2018_01_01_preview.models.PrivateLinkResourcesListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_regions_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_regions_operations.py
index ae0c8ebd786db..407ca8154a7d9 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_regions_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2018_01_01_preview/operations/_regions_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 (
@@ -31,7 +30,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -103,7 +102,7 @@ def list_by_sku(self, sku: str, **kwargs: Any) -> Iterable["_models.MessagingReg
)
cls: ClsType[_models.MessagingRegionsListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/__init__.py
index 7fb5add1ee3c8..2c8cfb26ae171 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_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 ._event_hub_management_client import EventHubManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._event_hub_management_client import EventHubManagementClient # 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__ = [
"EventHubManagementClient",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/_configuration.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/_configuration.py
index ce98638478d0a..719e49e3fca83 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/_configuration.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_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 EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+class EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for EventHubManagementClient.
Note that all parameters used to create this instance are saved as instance
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/_event_hub_management_client.py
index 28ebd7a2e7334..0e0445649df97 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/_event_hub_management_client.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/_event_hub_management_client.py
@@ -29,11 +29,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class EventHubManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class EventHubManagementClient: # pylint: disable=too-many-instance-attributes
"""Azure Event Hubs client for managing namespaces.
:ivar namespaces: NamespacesOperations operations
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/_version.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/_version.py
index 3767c560d3516..e5754a47ce68f 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/_version.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "11.1.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/__init__.py
index 699f917e93165..3cca02660c65c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_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 ._event_hub_management_client import EventHubManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._event_hub_management_client import EventHubManagementClient # 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__ = [
"EventHubManagementClient",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/_configuration.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/_configuration.py
index 199b7e45d8046..a9ecebd216c64 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/_configuration.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_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 EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+class EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for EventHubManagementClient.
Note that all parameters used to create this instance are saved as instance
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/_event_hub_management_client.py
index 33cbe770600c3..e7fad3afb879a 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/_event_hub_management_client.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/_event_hub_management_client.py
@@ -29,11 +29,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class EventHubManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class EventHubManagementClient: # pylint: disable=too-many-instance-attributes
"""Azure Event Hubs client for managing namespaces.
:ivar namespaces: NamespacesOperations operations
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/__init__.py
index 1b3f224b21618..44a58872b6d6e 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/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 ._namespaces_operations import NamespacesOperations
-from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
-from ._private_link_resources_operations import PrivateLinkResourcesOperations
-from ._operations import Operations
-from ._event_hubs_operations import EventHubsOperations
-from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations
-from ._consumer_groups_operations import ConsumerGroupsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._namespaces_operations import NamespacesOperations # type: ignore
+from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore
+from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore
+from ._operations import Operations # type: ignore
+from ._event_hubs_operations import EventHubsOperations # type: ignore
+from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations # type: ignore
+from ._consumer_groups_operations import ConsumerGroupsOperations # 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 @@
"DisasterRecoveryConfigsOperations",
"ConsumerGroupsOperations",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_consumer_groups_operations.py
index 915ba6a1d8dc0..deb9b3823a72b 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_consumer_groups_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_consumer_groups_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -38,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]]
@@ -154,7 +153,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -214,7 +213,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,
namespace_name: str,
@@ -236,7 +235,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 +301,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -388,7 +387,7 @@ def list_by_event_hub(
)
cls: ClsType[_models.ConsumerGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py
index c2ed80ab6c80f..937c3f0e552dd 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -44,7 +43,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]]
@@ -144,7 +143,7 @@ async def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -224,7 +223,7 @@ def list(
)
cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -372,7 +371,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.ArmDisasterRecovery or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -433,9 +432,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, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def delete(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""Deletes an Alias(Disaster Recovery configuration).
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -448,7 +445,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,
@@ -506,7 +503,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -553,9 +550,7 @@ async def get(
return deserialized # type: ignore
@distributed_trace_async
- async def break_pairing( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def break_pairing(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""This operation disables the Disaster Recovery and stops replicating changes from primary to
secondary namespaces.
@@ -569,7 +564,7 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -612,9 +607,7 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements
return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def fail_over( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def fail_over(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace.
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -627,7 +620,7 @@ async def fail_over( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -694,7 +687,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -776,7 +769,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -841,7 +834,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_event_hubs_operations.py
index 4c4e86ca2538f..c57c16d731cd5 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_event_hubs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_event_hubs_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
@@ -44,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]]
@@ -104,7 +104,7 @@ def list_by_namespace(
)
cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -251,7 +251,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -310,9 +310,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, namespace_name: str, event_hub_name: str, **kwargs: Any
- ) -> None:
+ async def delete(self, resource_group_name: str, namespace_name: str, event_hub_name: str, **kwargs: Any) -> None:
"""Deletes an Event Hub from the specified Namespace and resource group.
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -325,7 +323,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,
@@ -383,7 +381,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -454,7 +452,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -613,7 +611,7 @@ async def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -695,7 +693,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -743,7 +741,7 @@ async def get_authorization_rule(
return deserialized # type: ignore
@distributed_trace_async
- async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
+ async def delete_authorization_rule(
self,
resource_group_name: str,
namespace_name: str,
@@ -765,7 +763,7 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -831,7 +829,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -973,7 +971,7 @@ async def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_namespaces_operations.py
index 6ac3cb21b85ef..77dd318844b0a 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_namespaces_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_namespaces_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, AsyncIterator, 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,6 +18,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -51,7 +53,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]]
@@ -93,7 +95,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.EHNamespace"]:
)
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -173,7 +175,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy
)
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -242,7 +244,7 @@ async def _create_or_update_initial(
parameters: Union[_models.EHNamespace, IO[bytes]],
**kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -280,6 +282,7 @@ async def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -288,19 +291,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -441,7 +440,7 @@ def get_long_running_output(pipeline_response):
async def _delete_initial(
self, resource_group_name: str, namespace_name: str, **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -467,6 +466,7 @@ async def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -475,19 +475,15 @@ async def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -561,7 +557,7 @@ async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.EHNamespace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -682,7 +678,7 @@ async def update(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.EHNamespace or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -733,11 +729,7 @@ async def update(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
+ deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -817,7 +809,7 @@ async def create_or_update_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -888,7 +880,7 @@ async def get_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -956,7 +948,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1102,7 +1094,7 @@ async def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1161,7 +1153,7 @@ async def create_or_update_authorization_rule(
return deserialized # type: ignore
@distributed_trace_async
- async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
+ async def delete_authorization_rule(
self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any
) -> None:
"""Deletes an AuthorizationRule for a Namespace.
@@ -1176,7 +1168,7 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1234,7 +1226,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1296,7 +1288,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1425,7 +1417,7 @@ async def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1534,7 +1526,7 @@ async def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_operations.py
index ed48396fd78b4..dd1e079dc35be 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_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
@@ -31,7 +30,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]]
@@ -73,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,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_private_endpoint_connections_operations.py
index c1310c368c14a..b5b518084def9 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_private_endpoint_connections_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_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, AsyncIterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -40,7 +41,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 +70,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, resource_group_name: str, namespace_name: str, **kwargs: Any
) -> AsyncIterable["_models.PrivateEndpointConnection"]:
+ # pylint: disable=line-too-long
"""Gets the available PrivateEndpointConnections within a namespace.
.. seealso::
@@ -92,7 +94,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,
@@ -249,7 +251,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -300,11 +302,7 @@ async def create_or_update(
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("PrivateEndpointConnection", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -314,7 +312,7 @@ async def create_or_update(
async def _delete_initial(
self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -341,6 +339,7 @@ async def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -349,19 +348,15 @@ async def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -450,7 +445,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_private_link_resources_operations.py
index 365aed585857f..46db256418bf4 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_private_link_resources_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_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,
@@ -29,7 +28,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]]
@@ -71,7 +70,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.PrivateLinkResourcesListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/models/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/models/__init__.py
index 1a17bb5e61d2a..0f26d6143e298 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/models/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/models/__init__.py
@@ -5,64 +5,75 @@
# 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 AccessKeys
-from ._models_py3 import ArmDisasterRecovery
-from ._models_py3 import ArmDisasterRecoveryListResult
-from ._models_py3 import AuthorizationRule
-from ._models_py3 import AuthorizationRuleListResult
-from ._models_py3 import CaptureDescription
-from ._models_py3 import CheckNameAvailabilityParameter
-from ._models_py3 import CheckNameAvailabilityResult
-from ._models_py3 import ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties
-from ._models_py3 import ConnectionState
-from ._models_py3 import ConsumerGroup
-from ._models_py3 import ConsumerGroupListResult
-from ._models_py3 import Destination
-from ._models_py3 import EHNamespace
-from ._models_py3 import EHNamespaceListResult
-from ._models_py3 import Encryption
-from ._models_py3 import ErrorResponse
-from ._models_py3 import EventHubListResult
-from ._models_py3 import Eventhub
-from ._models_py3 import Identity
-from ._models_py3 import KeyVaultProperties
-from ._models_py3 import NWRuleSetIpRules
-from ._models_py3 import NWRuleSetVirtualNetworkRules
-from ._models_py3 import NetworkRuleSet
-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 PrivateLinkResourcesListResult
-from ._models_py3 import RegenerateAccessKeyParameters
-from ._models_py3 import Resource
-from ._models_py3 import Sku
-from ._models_py3 import Subnet
-from ._models_py3 import SystemData
-from ._models_py3 import TrackedResource
-from ._models_py3 import UserAssignedIdentityProperties
+from typing import TYPE_CHECKING
-from ._event_hub_management_client_enums import AccessRights
-from ._event_hub_management_client_enums import CreatedByType
-from ._event_hub_management_client_enums import DefaultAction
-from ._event_hub_management_client_enums import EncodingCaptureDescription
-from ._event_hub_management_client_enums import EndPointProvisioningState
-from ._event_hub_management_client_enums import EntityStatus
-from ._event_hub_management_client_enums import KeyType
-from ._event_hub_management_client_enums import ManagedServiceIdentityType
-from ._event_hub_management_client_enums import NetworkRuleIPAction
-from ._event_hub_management_client_enums import PrivateLinkConnectionStatus
-from ._event_hub_management_client_enums import ProvisioningStateDR
-from ._event_hub_management_client_enums import RoleDisasterRecovery
-from ._event_hub_management_client_enums import SkuName
-from ._event_hub_management_client_enums import SkuTier
-from ._event_hub_management_client_enums import UnavailableReason
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ AccessKeys,
+ ArmDisasterRecovery,
+ ArmDisasterRecoveryListResult,
+ AuthorizationRule,
+ AuthorizationRuleListResult,
+ CaptureDescription,
+ CheckNameAvailabilityParameter,
+ CheckNameAvailabilityResult,
+ ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties,
+ ConnectionState,
+ ConsumerGroup,
+ ConsumerGroupListResult,
+ Destination,
+ EHNamespace,
+ EHNamespaceListResult,
+ Encryption,
+ ErrorResponse,
+ EventHubListResult,
+ Eventhub,
+ Identity,
+ KeyVaultProperties,
+ NWRuleSetIpRules,
+ NWRuleSetVirtualNetworkRules,
+ NetworkRuleSet,
+ Operation,
+ OperationDisplay,
+ OperationListResult,
+ PrivateEndpoint,
+ PrivateEndpointConnection,
+ PrivateEndpointConnectionListResult,
+ PrivateLinkResource,
+ PrivateLinkResourcesListResult,
+ RegenerateAccessKeyParameters,
+ Resource,
+ Sku,
+ Subnet,
+ SystemData,
+ TrackedResource,
+ UserAssignedIdentityProperties,
+)
+
+from ._event_hub_management_client_enums import ( # type: ignore
+ AccessRights,
+ CreatedByType,
+ DefaultAction,
+ EncodingCaptureDescription,
+ EndPointProvisioningState,
+ EntityStatus,
+ KeyType,
+ ManagedServiceIdentityType,
+ NetworkRuleIPAction,
+ PrivateLinkConnectionStatus,
+ ProvisioningStateDR,
+ RoleDisasterRecovery,
+ SkuName,
+ SkuTier,
+ UnavailableReason,
+)
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__ = [
@@ -121,5 +132,5 @@
"SkuTier",
"UnavailableReason",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/models/_models_py3.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/models/_models_py3.py
index cabaed9e58630..2ec6e077e1804 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/models/_models_py3.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_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
@@ -695,7 +694,7 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s
self.tags = tags
-class EHNamespace(TrackedResource): # pylint: disable=too-many-instance-attributes
+class EHNamespace(TrackedResource):
"""Single Namespace item in List or Get Operation.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -955,7 +954,7 @@ def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None,
self.message = message
-class Eventhub(Resource): # pylint: disable=too-many-instance-attributes
+class Eventhub(Resource):
"""Single item in List or Get Event Hub operation.
Variables are only populated by the server, and will be ignored when sending a request.
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/__init__.py
index 1b3f224b21618..44a58872b6d6e 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/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 ._namespaces_operations import NamespacesOperations
-from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
-from ._private_link_resources_operations import PrivateLinkResourcesOperations
-from ._operations import Operations
-from ._event_hubs_operations import EventHubsOperations
-from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations
-from ._consumer_groups_operations import ConsumerGroupsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._namespaces_operations import NamespacesOperations # type: ignore
+from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore
+from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore
+from ._operations import Operations # type: ignore
+from ._event_hubs_operations import EventHubsOperations # type: ignore
+from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations # type: ignore
+from ._consumer_groups_operations import ConsumerGroupsOperations # 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 @@
"DisasterRecoveryConfigsOperations",
"ConsumerGroupsOperations",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_consumer_groups_operations.py
index cf5c1c673f92e..e98558b97f1fe 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_consumer_groups_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_consumer_groups_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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 (
@@ -32,7 +31,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -353,7 +352,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -435,7 +434,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,
@@ -501,7 +500,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -587,7 +586,7 @@ def list_by_event_hub(
)
cls: ClsType[_models.ConsumerGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_disaster_recovery_configs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_disaster_recovery_configs_operations.py
index 1e85517eb35d8..5a3ca04f57797 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_disaster_recovery_configs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_disaster_recovery_configs_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 (
@@ -32,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -565,7 +565,7 @@ def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -645,7 +645,7 @@ def list(
)
cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -793,7 +793,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.ArmDisasterRecovery or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -869,7 +869,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,
@@ -927,7 +927,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -990,7 +990,7 @@ def break_pairing( # pylint: disable=inconsistent-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 +1048,7 @@ def fail_over( # pylint: disable=inconsistent-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 +1115,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1197,7 +1197,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1262,7 +1262,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_event_hubs_operations.py
index a4a0cbe31969d..1b86b86d6c6f7 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_event_hubs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_event_hubs_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 (
@@ -32,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -562,7 +562,7 @@ def list_by_namespace(
)
cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -709,7 +709,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -783,7 +783,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,
@@ -841,7 +841,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -912,7 +912,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1071,7 +1071,7 @@ def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1153,7 +1153,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1223,7 +1223,7 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1289,7 +1289,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1431,7 +1431,7 @@ def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_namespaces_operations.py
index a3ef4484e9b6e..dec53969b21d4 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_namespaces_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_namespaces_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, Iterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -672,7 +674,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.EHNamespace"]:
)
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -752,7 +754,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite
)
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -821,7 +823,7 @@ def _create_or_update_initial(
parameters: Union[_models.EHNamespace, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -859,6 +861,7 @@ def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -867,19 +870,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1018,7 +1017,7 @@ def get_long_running_output(pipeline_response):
)
def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1044,6 +1043,7 @@ def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwarg
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -1052,19 +1052,15 @@ def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwarg
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1138,7 +1134,7 @@ def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.EHNamespace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1259,7 +1255,7 @@ def update(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.EHNamespace or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1310,11 +1306,7 @@ def update(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
+ deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1394,7 +1386,7 @@ def create_or_update_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1465,7 +1457,7 @@ def get_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1533,7 +1525,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1679,7 +1671,7 @@ def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1753,7 +1745,7 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1811,7 +1803,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1873,7 +1865,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2002,7 +1994,7 @@ def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2111,7 +2103,7 @@ def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_operations.py
index 65e0c329f7eee..2cbc3757f73b2 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_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 (
@@ -31,7 +30,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -94,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,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_private_endpoint_connections_operations.py
index f06e43bb9ef07..b19a6d97bdf9d 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_private_endpoint_connections_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_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, Iterator, 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,6 +16,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,7 +35,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -273,7 +274,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,
@@ -430,7 +431,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -481,11 +482,7 @@ def create_or_update(
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("PrivateEndpointConnection", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -495,7 +492,7 @@ def create_or_update(
def _delete_initial(
self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -522,6 +519,7 @@ def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -530,19 +528,15 @@ def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -631,7 +625,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_private_link_resources_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_private_link_resources_operations.py
index bcdf6244af97b..b7dafe3461e4c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/operations/_private_link_resources_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_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,
@@ -29,7 +28,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -114,7 +113,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2021_01_01_preview.models.PrivateLinkResourcesListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/__init__.py
index 7fb5add1ee3c8..2c8cfb26ae171 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_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 ._event_hub_management_client import EventHubManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._event_hub_management_client import EventHubManagementClient # 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__ = [
"EventHubManagementClient",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/_configuration.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/_configuration.py
index c26680bd47d4c..0a501d0d688ee 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/_configuration.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_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 EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+class EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for EventHubManagementClient.
Note that all parameters used to create this instance are saved as instance
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/_event_hub_management_client.py
index 3f124d1d6e331..5afc70e3ce0ae 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/_event_hub_management_client.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/_event_hub_management_client.py
@@ -31,11 +31,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class EventHubManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class EventHubManagementClient: # pylint: disable=too-many-instance-attributes
"""Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules
resources.
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/_version.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/_version.py
index 3767c560d3516..e5754a47ce68f 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/_version.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "11.1.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/__init__.py
index 699f917e93165..3cca02660c65c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_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 ._event_hub_management_client import EventHubManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._event_hub_management_client import EventHubManagementClient # 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__ = [
"EventHubManagementClient",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/_configuration.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/_configuration.py
index e740f18441fdc..b862401e2467f 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/_configuration.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_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 EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+class EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for EventHubManagementClient.
Note that all parameters used to create this instance are saved as instance
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/_event_hub_management_client.py
index f976256ff844f..a15a0aeb47df2 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/_event_hub_management_client.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/_event_hub_management_client.py
@@ -31,11 +31,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class EventHubManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class EventHubManagementClient: # pylint: disable=too-many-instance-attributes
"""Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules
resources.
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/__init__.py
index d2e10ef2f394b..682117a9bf89d 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/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 ._clusters_operations import ClustersOperations
-from ._configuration_operations import ConfigurationOperations
-from ._namespaces_operations import NamespacesOperations
-from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
-from ._private_link_resources_operations import PrivateLinkResourcesOperations
-from ._operations import Operations
-from ._event_hubs_operations import EventHubsOperations
-from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations
-from ._consumer_groups_operations import ConsumerGroupsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._clusters_operations import ClustersOperations # type: ignore
+from ._configuration_operations import ConfigurationOperations # type: ignore
+from ._namespaces_operations import NamespacesOperations # type: ignore
+from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore
+from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore
+from ._operations import Operations # type: ignore
+from ._event_hubs_operations import EventHubsOperations # type: ignore
+from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations # type: ignore
+from ._consumer_groups_operations import ConsumerGroupsOperations # 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 @@
"DisasterRecoveryConfigsOperations",
"ConsumerGroupsOperations",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_clusters_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_clusters_operations.py
index 13283ff7c622b..88fdf98354e66 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_clusters_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_clusters_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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, AsyncIterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -44,7 +45,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]]
@@ -77,7 +78,7 @@ async def list_available_cluster_region(self, **kwargs: Any) -> _models.Availabl
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AvailableClustersList
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -137,7 +138,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Cluster"
)
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -217,7 +218,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy
)
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -291,7 +292,7 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any)
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.Cluster
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -339,7 +340,7 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any)
async def _create_or_update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -377,6 +378,7 @@ async def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -385,19 +387,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -531,7 +529,7 @@ def get_long_running_output(pipeline_response):
async def _update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -569,6 +567,7 @@ async def _update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -577,19 +576,15 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -721,7 +716,7 @@ def get_long_running_output(pipeline_response):
)
async def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -747,6 +742,7 @@ async def _delete_initial(self, resource_group_name: str, cluster_name: str, **k
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -755,19 +751,15 @@ async def _delete_initial(self, resource_group_name: str, cluster_name: str, **k
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -842,7 +834,7 @@ async def list_namespaces(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.EHNamespaceIdListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_configuration_operations.py
index 6b4576c32c7c1..17fbf25b50bae 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_configuration_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_configuration_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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,
@@ -30,7 +29,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 +136,7 @@ async def patch(
None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -188,11 +187,7 @@ async def patch(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
+ deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -214,7 +209,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.ClusterQuotaConfigurationProperties
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_consumer_groups_operations.py
index 4477d0ed87057..9da9ad7f7a891 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_consumer_groups_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_consumer_groups_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -38,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]]
@@ -154,7 +153,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -214,7 +213,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,
namespace_name: str,
@@ -236,7 +235,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 +301,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -388,7 +387,7 @@ def list_by_event_hub(
)
cls: ClsType[_models.ConsumerGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_disaster_recovery_configs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_disaster_recovery_configs_operations.py
index f6042a59053c9..a4e58997d135c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_disaster_recovery_configs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_disaster_recovery_configs_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -44,7 +43,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]]
@@ -144,7 +143,7 @@ async def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -224,7 +223,7 @@ def list(
)
cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -372,7 +371,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.ArmDisasterRecovery or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -433,9 +432,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, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def delete(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""Deletes an Alias(Disaster Recovery configuration).
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -448,7 +445,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,
@@ -506,7 +503,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -553,9 +550,7 @@ async def get(
return deserialized # type: ignore
@distributed_trace_async
- async def break_pairing( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def break_pairing(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""This operation disables the Disaster Recovery and stops replicating changes from primary to
secondary namespaces.
@@ -569,7 +564,7 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -612,9 +607,7 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements
return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def fail_over( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def fail_over(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace.
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -627,7 +620,7 @@ async def fail_over( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -694,7 +687,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -776,7 +769,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -841,7 +834,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_event_hubs_operations.py
index b5416abf169fe..c0aaaf8b24fdd 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_event_hubs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_event_hubs_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
@@ -44,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]]
@@ -104,7 +104,7 @@ def list_by_namespace(
)
cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -251,7 +251,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -310,9 +310,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, namespace_name: str, event_hub_name: str, **kwargs: Any
- ) -> None:
+ async def delete(self, resource_group_name: str, namespace_name: str, event_hub_name: str, **kwargs: Any) -> None:
"""Deletes an Event Hub from the specified Namespace and resource group.
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -325,7 +323,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,
@@ -383,7 +381,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -454,7 +452,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -613,7 +611,7 @@ async def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -695,7 +693,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -743,7 +741,7 @@ async def get_authorization_rule(
return deserialized # type: ignore
@distributed_trace_async
- async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
+ async def delete_authorization_rule(
self,
resource_group_name: str,
namespace_name: str,
@@ -765,7 +763,7 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -831,7 +829,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -973,7 +971,7 @@ async def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_namespaces_operations.py
index e0b073ab2751a..da00c781489c8 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_namespaces_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_namespaces_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, AsyncIterator, 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,6 +18,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -51,7 +53,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]]
@@ -93,7 +95,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.EHNamespace"]:
)
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -173,7 +175,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy
)
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -242,7 +244,7 @@ async def _create_or_update_initial(
parameters: Union[_models.EHNamespace, IO[bytes]],
**kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -280,6 +282,7 @@ async def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -288,19 +291,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -441,7 +440,7 @@ def get_long_running_output(pipeline_response):
async def _delete_initial(
self, resource_group_name: str, namespace_name: str, **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -467,6 +466,7 @@ async def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -475,19 +475,15 @@ async def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -561,7 +557,7 @@ async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.EHNamespace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -682,7 +678,7 @@ async def update(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.EHNamespace or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -733,11 +729,7 @@ async def update(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
+ deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -817,7 +809,7 @@ async def create_or_update_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -888,7 +880,7 @@ async def get_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -956,7 +948,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1102,7 +1094,7 @@ async def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1161,7 +1153,7 @@ async def create_or_update_authorization_rule(
return deserialized # type: ignore
@distributed_trace_async
- async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
+ async def delete_authorization_rule(
self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any
) -> None:
"""Deletes an AuthorizationRule for a Namespace.
@@ -1176,7 +1168,7 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1234,7 +1226,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1296,7 +1288,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1425,7 +1417,7 @@ async def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1534,7 +1526,7 @@ async def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_operations.py
index fb9582d9ebc8e..88887d73cba62 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_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
@@ -31,7 +30,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]]
@@ -73,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,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py
index 629850a6da4f3..7bf617272fe68 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_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, AsyncIterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -40,7 +41,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 +70,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, resource_group_name: str, namespace_name: str, **kwargs: Any
) -> AsyncIterable["_models.PrivateEndpointConnection"]:
+ # pylint: disable=line-too-long
"""Gets the available PrivateEndpointConnections within a namespace.
.. seealso::
@@ -92,7 +94,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,
@@ -249,7 +251,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -300,11 +302,7 @@ async def create_or_update(
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("PrivateEndpointConnection", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -314,7 +312,7 @@ async def create_or_update(
async def _delete_initial(
self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -341,6 +339,7 @@ async def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -349,19 +348,15 @@ async def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -450,7 +445,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_private_link_resources_operations.py
index c4c68d35ea82d..12614eb026b46 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/aio/operations/_private_link_resources_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_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,
@@ -29,7 +28,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]]
@@ -71,7 +70,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.PrivateLinkResourcesListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/models/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/models/__init__.py
index 4de339c7fd00e..06144266b08c7 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/models/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/models/__init__.py
@@ -5,74 +5,85 @@
# 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 AccessKeys
-from ._models_py3 import ArmDisasterRecovery
-from ._models_py3 import ArmDisasterRecoveryListResult
-from ._models_py3 import AuthorizationRule
-from ._models_py3 import AuthorizationRuleListResult
-from ._models_py3 import AvailableCluster
-from ._models_py3 import AvailableClustersList
-from ._models_py3 import CaptureDescription
-from ._models_py3 import CheckNameAvailabilityParameter
-from ._models_py3 import CheckNameAvailabilityResult
-from ._models_py3 import Cluster
-from ._models_py3 import ClusterListResult
-from ._models_py3 import ClusterQuotaConfigurationProperties
-from ._models_py3 import ClusterSku
-from ._models_py3 import ConnectionState
-from ._models_py3 import ConsumerGroup
-from ._models_py3 import ConsumerGroupListResult
-from ._models_py3 import Destination
-from ._models_py3 import EHNamespace
-from ._models_py3 import EHNamespaceIdContainer
-from ._models_py3 import EHNamespaceIdListResult
-from ._models_py3 import EHNamespaceListResult
-from ._models_py3 import Encryption
-from ._models_py3 import ErrorResponse
-from ._models_py3 import EventHubListResult
-from ._models_py3 import Eventhub
-from ._models_py3 import Identity
-from ._models_py3 import KeyVaultProperties
-from ._models_py3 import NWRuleSetIpRules
-from ._models_py3 import NWRuleSetVirtualNetworkRules
-from ._models_py3 import NetworkRuleSet
-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 PrivateLinkResourcesListResult
-from ._models_py3 import RegenerateAccessKeyParameters
-from ._models_py3 import Resource
-from ._models_py3 import Sku
-from ._models_py3 import Subnet
-from ._models_py3 import SystemData
-from ._models_py3 import TrackedResource
-from ._models_py3 import UserAssignedIdentity
-from ._models_py3 import UserAssignedIdentityProperties
+from typing import TYPE_CHECKING
-from ._event_hub_management_client_enums import AccessRights
-from ._event_hub_management_client_enums import ClusterSkuName
-from ._event_hub_management_client_enums import CreatedByType
-from ._event_hub_management_client_enums import DefaultAction
-from ._event_hub_management_client_enums import EncodingCaptureDescription
-from ._event_hub_management_client_enums import EndPointProvisioningState
-from ._event_hub_management_client_enums import EntityStatus
-from ._event_hub_management_client_enums import KeyType
-from ._event_hub_management_client_enums import ManagedServiceIdentityType
-from ._event_hub_management_client_enums import NetworkRuleIPAction
-from ._event_hub_management_client_enums import PrivateLinkConnectionStatus
-from ._event_hub_management_client_enums import ProvisioningStateDR
-from ._event_hub_management_client_enums import PublicNetworkAccessFlag
-from ._event_hub_management_client_enums import RoleDisasterRecovery
-from ._event_hub_management_client_enums import SkuName
-from ._event_hub_management_client_enums import SkuTier
-from ._event_hub_management_client_enums import UnavailableReason
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ AccessKeys,
+ ArmDisasterRecovery,
+ ArmDisasterRecoveryListResult,
+ AuthorizationRule,
+ AuthorizationRuleListResult,
+ AvailableCluster,
+ AvailableClustersList,
+ CaptureDescription,
+ CheckNameAvailabilityParameter,
+ CheckNameAvailabilityResult,
+ Cluster,
+ ClusterListResult,
+ ClusterQuotaConfigurationProperties,
+ ClusterSku,
+ ConnectionState,
+ ConsumerGroup,
+ ConsumerGroupListResult,
+ Destination,
+ EHNamespace,
+ EHNamespaceIdContainer,
+ EHNamespaceIdListResult,
+ EHNamespaceListResult,
+ Encryption,
+ ErrorResponse,
+ EventHubListResult,
+ Eventhub,
+ Identity,
+ KeyVaultProperties,
+ NWRuleSetIpRules,
+ NWRuleSetVirtualNetworkRules,
+ NetworkRuleSet,
+ Operation,
+ OperationDisplay,
+ OperationListResult,
+ PrivateEndpoint,
+ PrivateEndpointConnection,
+ PrivateEndpointConnectionListResult,
+ PrivateLinkResource,
+ PrivateLinkResourcesListResult,
+ RegenerateAccessKeyParameters,
+ Resource,
+ Sku,
+ Subnet,
+ SystemData,
+ TrackedResource,
+ UserAssignedIdentity,
+ UserAssignedIdentityProperties,
+)
+
+from ._event_hub_management_client_enums import ( # type: ignore
+ AccessRights,
+ ClusterSkuName,
+ CreatedByType,
+ DefaultAction,
+ EncodingCaptureDescription,
+ EndPointProvisioningState,
+ EntityStatus,
+ KeyType,
+ ManagedServiceIdentityType,
+ NetworkRuleIPAction,
+ PrivateLinkConnectionStatus,
+ ProvisioningStateDR,
+ PublicNetworkAccessFlag,
+ RoleDisasterRecovery,
+ SkuName,
+ SkuTier,
+ UnavailableReason,
+)
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__ = [
@@ -141,5 +152,5 @@
"SkuTier",
"UnavailableReason",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/models/_models_py3.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/models/_models_py3.py
index 586b2a74eb0be..e06cbaba4aac1 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/models/_models_py3.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_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
@@ -525,7 +524,7 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s
self.tags = tags
-class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes
+class Cluster(TrackedResource):
"""Single Event Hubs Cluster resource in List or Get operations.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -870,7 +869,7 @@ def __init__(
self.archive_name_format = archive_name_format
-class EHNamespace(TrackedResource): # pylint: disable=too-many-instance-attributes
+class EHNamespace(TrackedResource):
"""Single Namespace item in List or Get Operation.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1178,7 +1177,7 @@ def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None,
self.message = message
-class Eventhub(Resource): # pylint: disable=too-many-instance-attributes
+class Eventhub(Resource):
"""Single item in List or Get Event Hub operation.
Variables are only populated by the server, and will be ignored when sending a request.
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/__init__.py
index d2e10ef2f394b..682117a9bf89d 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/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 ._clusters_operations import ClustersOperations
-from ._configuration_operations import ConfigurationOperations
-from ._namespaces_operations import NamespacesOperations
-from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
-from ._private_link_resources_operations import PrivateLinkResourcesOperations
-from ._operations import Operations
-from ._event_hubs_operations import EventHubsOperations
-from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations
-from ._consumer_groups_operations import ConsumerGroupsOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._clusters_operations import ClustersOperations # type: ignore
+from ._configuration_operations import ConfigurationOperations # type: ignore
+from ._namespaces_operations import NamespacesOperations # type: ignore
+from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore
+from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore
+from ._operations import Operations # type: ignore
+from ._event_hubs_operations import EventHubsOperations # type: ignore
+from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations # type: ignore
+from ._consumer_groups_operations import ConsumerGroupsOperations # 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 @@
"DisasterRecoveryConfigsOperations",
"ConsumerGroupsOperations",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_clusters_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_clusters_operations.py
index d607c19588eda..745c25c280f06 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_clusters_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_clusters_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, Iterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -321,7 +323,7 @@ def list_available_cluster_region(self, **kwargs: Any) -> _models.AvailableClust
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AvailableClustersList
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -380,7 +382,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Cluster"]:
)
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -459,7 +461,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite
)
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -533,7 +535,7 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.Cluster
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -581,7 +583,7 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo
def _create_or_update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -619,6 +621,7 @@ def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -627,19 +630,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -767,7 +766,7 @@ def get_long_running_output(pipeline_response):
def _update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -805,6 +804,7 @@ def _update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -813,19 +813,15 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -951,7 +947,7 @@ def get_long_running_output(pipeline_response):
)
def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -977,6 +973,7 @@ def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs:
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -985,19 +982,15 @@ def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs:
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1072,7 +1065,7 @@ def list_namespaces(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.EHNamespaceIdListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_configuration_operations.py
index 6cb3cb4c9118b..f6796f7399ea7 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_configuration_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_configuration_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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,
@@ -30,7 +29,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -207,7 +206,7 @@ def patch(
None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -258,11 +257,7 @@ def patch(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
+ deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -284,7 +279,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.ClusterQuotaConfigurationProperties
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_consumer_groups_operations.py
index 556fda3a2c9f0..501e420ce3f8a 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_consumer_groups_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_consumer_groups_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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 (
@@ -32,7 +31,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -353,7 +352,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -435,7 +434,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,
@@ -501,7 +500,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -587,7 +586,7 @@ def list_by_event_hub(
)
cls: ClsType[_models.ConsumerGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_disaster_recovery_configs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_disaster_recovery_configs_operations.py
index 1c9264c8489fd..a38355e487335 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_disaster_recovery_configs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_disaster_recovery_configs_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 (
@@ -32,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -565,7 +565,7 @@ def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -645,7 +645,7 @@ def list(
)
cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -793,7 +793,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.ArmDisasterRecovery or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -869,7 +869,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,
@@ -927,7 +927,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -990,7 +990,7 @@ def break_pairing( # pylint: disable=inconsistent-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 +1048,7 @@ def fail_over( # pylint: disable=inconsistent-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 +1115,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1197,7 +1197,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1262,7 +1262,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_event_hubs_operations.py
index 9f0f0b3698393..7d67770a85592 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_event_hubs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_event_hubs_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 (
@@ -32,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -562,7 +562,7 @@ def list_by_namespace(
)
cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -709,7 +709,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -783,7 +783,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,
@@ -841,7 +841,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -912,7 +912,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1071,7 +1071,7 @@ def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1153,7 +1153,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1223,7 +1223,7 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1289,7 +1289,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1431,7 +1431,7 @@ def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_namespaces_operations.py
index 3052a0182558f..1ef7d75c7bed0 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_namespaces_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_namespaces_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, Iterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -672,7 +674,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.EHNamespace"]:
)
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -752,7 +754,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite
)
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -821,7 +823,7 @@ def _create_or_update_initial(
parameters: Union[_models.EHNamespace, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -859,6 +861,7 @@ def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -867,19 +870,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1018,7 +1017,7 @@ def get_long_running_output(pipeline_response):
)
def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1044,6 +1043,7 @@ def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwarg
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -1052,19 +1052,15 @@ def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwarg
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1138,7 +1134,7 @@ def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.EHNamespace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1259,7 +1255,7 @@ def update(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.EHNamespace or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1310,11 +1306,7 @@ def update(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
+ deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1394,7 +1386,7 @@ def create_or_update_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1465,7 +1457,7 @@ def get_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1533,7 +1525,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1679,7 +1671,7 @@ def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1753,7 +1745,7 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1811,7 +1803,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1873,7 +1865,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2002,7 +1994,7 @@ def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2111,7 +2103,7 @@ def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_operations.py
index 279d8f3808f2b..02512bbe9fe98 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_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 (
@@ -31,7 +30,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -94,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,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py
index 95ad0f1e4233d..8b59ced773182 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_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, Iterator, 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,6 +16,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,7 +35,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -273,7 +274,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,
@@ -430,7 +431,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -481,11 +482,7 @@ def create_or_update(
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("PrivateEndpointConnection", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -495,7 +492,7 @@ def create_or_update(
def _delete_initial(
self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -522,6 +519,7 @@ def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -530,19 +528,15 @@ def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -631,7 +625,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_private_link_resources_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_private_link_resources_operations.py
index 65bb67672d7e6..1cc3e6a722991 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_01_preview/operations/_private_link_resources_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_06_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,
@@ -29,7 +28,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -114,7 +113,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2021_06_01_preview.models.PrivateLinkResourcesListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/__init__.py
index 7fb5add1ee3c8..2c8cfb26ae171 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_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 ._event_hub_management_client import EventHubManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._event_hub_management_client import EventHubManagementClient # 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__ = [
"EventHubManagementClient",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_configuration.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_configuration.py
index 7bbc03fc00a26..8682dfdfb9821 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_configuration.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_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 EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+class EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for EventHubManagementClient.
Note that all parameters used to create this instance are saved as instance
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_event_hub_management_client.py
index 1c33e0d070cb8..49ff8dfa40ada 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_event_hub_management_client.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_event_hub_management_client.py
@@ -32,11 +32,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class EventHubManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class EventHubManagementClient: # pylint: disable=too-many-instance-attributes
"""Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules
resources.
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_version.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_version.py
index 3767c560d3516..e5754a47ce68f 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_version.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "11.1.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/__init__.py
index 699f917e93165..3cca02660c65c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_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 ._event_hub_management_client import EventHubManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._event_hub_management_client import EventHubManagementClient # 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__ = [
"EventHubManagementClient",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/_configuration.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/_configuration.py
index 79fef386ea7aa..ec43ce1138be3 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/_configuration.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_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 EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+class EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for EventHubManagementClient.
Note that all parameters used to create this instance are saved as instance
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/_event_hub_management_client.py
index 0f6946c2ca397..378d59b897285 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/_event_hub_management_client.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/_event_hub_management_client.py
@@ -32,11 +32,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class EventHubManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class EventHubManagementClient: # pylint: disable=too-many-instance-attributes
"""Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules
resources.
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/__init__.py
index 9e81c0df7873d..a378c3a80ea93 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/__init__.py
@@ -5,20 +5,26 @@
# 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 ._clusters_operations import ClustersOperations
-from ._configuration_operations import ConfigurationOperations
-from ._namespaces_operations import NamespacesOperations
-from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
-from ._private_link_resources_operations import PrivateLinkResourcesOperations
-from ._operations import Operations
-from ._event_hubs_operations import EventHubsOperations
-from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations
-from ._consumer_groups_operations import ConsumerGroupsOperations
-from ._schema_registry_operations import SchemaRegistryOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._clusters_operations import ClustersOperations # type: ignore
+from ._configuration_operations import ConfigurationOperations # type: ignore
+from ._namespaces_operations import NamespacesOperations # type: ignore
+from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore
+from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore
+from ._operations import Operations # type: ignore
+from ._event_hubs_operations import EventHubsOperations # type: ignore
+from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations # type: ignore
+from ._consumer_groups_operations import ConsumerGroupsOperations # type: ignore
+from ._schema_registry_operations import SchemaRegistryOperations # 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__ = [
@@ -33,5 +39,5 @@
"ConsumerGroupsOperations",
"SchemaRegistryOperations",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_clusters_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_clusters_operations.py
index bcb90c7473324..aa2fb046a193b 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_clusters_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_clusters_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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, AsyncIterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -44,7 +45,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]]
@@ -77,7 +78,7 @@ async def list_available_cluster_region(self, **kwargs: Any) -> _models.Availabl
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AvailableClustersList
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -133,7 +134,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Cluster"
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -211,7 +212,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -285,7 +286,7 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any)
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.Cluster
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -331,7 +332,7 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any)
async def _create_or_update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -367,6 +368,7 @@ async def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -375,19 +377,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -516,7 +514,7 @@ def get_long_running_output(pipeline_response):
async def _update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -552,6 +550,7 @@ async def _update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -560,19 +559,15 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -699,7 +694,7 @@ def get_long_running_output(pipeline_response):
)
async def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -723,6 +718,7 @@ async def _delete_initial(self, resource_group_name: str, cluster_name: str, **k
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -731,19 +727,15 @@ async def _delete_initial(self, resource_group_name: str, cluster_name: str, **k
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -816,7 +808,7 @@ async def list_namespaces(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.EHNamespaceIdListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_configuration_operations.py
index 12f24637693f6..46ee2bd5ed455 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_configuration_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_configuration_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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,
@@ -30,7 +29,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 +131,7 @@ async def patch(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.ClusterQuotaConfigurationProperties or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -181,11 +180,7 @@ async def patch(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
+ deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -207,7 +202,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.ClusterQuotaConfigurationProperties
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_consumer_groups_operations.py
index b64911fe45d60..3f385a536954f 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_consumer_groups_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_consumer_groups_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -38,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]]
@@ -154,7 +153,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -212,7 +211,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,
namespace_name: str,
@@ -234,7 +233,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,
@@ -298,7 +297,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -380,7 +379,7 @@ def list_by_event_hub(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.ConsumerGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_disaster_recovery_configs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_disaster_recovery_configs_operations.py
index 58e0042a30c7d..245b427cb96b1 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_disaster_recovery_configs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_disaster_recovery_configs_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -44,7 +43,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]]
@@ -143,7 +142,7 @@ async def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -219,7 +218,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -366,7 +365,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.ArmDisasterRecovery or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -425,9 +424,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, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def delete(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""Deletes an Alias(Disaster Recovery configuration).
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -440,7 +437,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,
@@ -496,7 +493,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -541,9 +538,7 @@ async def get(
return deserialized # type: ignore
@distributed_trace_async
- async def break_pairing( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def break_pairing(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""This operation disables the Disaster Recovery and stops replicating changes from primary to
secondary namespaces.
@@ -557,7 +552,7 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -598,9 +593,7 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements
return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def fail_over( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def fail_over(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace.
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -613,7 +606,7 @@ async def fail_over( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -676,7 +669,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -758,7 +751,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -821,7 +814,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_event_hubs_operations.py
index d1e8e5722e706..db59f8cdef91b 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_event_hubs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_event_hubs_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
@@ -44,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]]
@@ -102,7 +102,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -249,7 +249,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -306,9 +306,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, namespace_name: str, event_hub_name: str, **kwargs: Any
- ) -> None:
+ async def delete(self, resource_group_name: str, namespace_name: str, event_hub_name: str, **kwargs: Any) -> None:
"""Deletes an Event Hub from the specified Namespace and resource group.
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -321,7 +319,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,
@@ -377,7 +375,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -444,7 +442,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -602,7 +600,7 @@ async def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -682,7 +680,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -728,7 +726,7 @@ async def get_authorization_rule(
return deserialized # type: ignore
@distributed_trace_async
- async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
+ async def delete_authorization_rule(
self,
resource_group_name: str,
namespace_name: str,
@@ -750,7 +748,7 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -814,7 +812,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -954,7 +952,7 @@ async def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_namespaces_operations.py
index acfcf050651a9..d4978b6830f13 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_namespaces_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_namespaces_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, AsyncIterator, 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,6 +18,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -52,7 +54,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 +94,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.EHNamespace"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -170,7 +172,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -239,7 +241,7 @@ async def _create_or_update_initial(
parameters: Union[_models.EHNamespace, IO[bytes]],
**kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -275,6 +277,7 @@ async def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -283,19 +286,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -431,7 +430,7 @@ def get_long_running_output(pipeline_response):
async def _delete_initial(
self, resource_group_name: str, namespace_name: str, **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -455,6 +454,7 @@ async def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -463,19 +463,15 @@ async def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -547,7 +543,7 @@ async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.EHNamespace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -666,7 +662,7 @@ async def update(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.EHNamespace or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -715,11 +711,7 @@ async def update(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
+ deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -799,7 +791,7 @@ async def create_or_update_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -868,7 +860,7 @@ async def get_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -925,7 +917,7 @@ async def list_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.NetworkRuleSetListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -989,7 +981,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1134,7 +1126,7 @@ async def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1191,7 +1183,7 @@ async def create_or_update_authorization_rule(
return deserialized # type: ignore
@distributed_trace_async
- async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
+ async def delete_authorization_rule(
self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any
) -> None:
"""Deletes an AuthorizationRule for a Namespace.
@@ -1206,7 +1198,7 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1262,7 +1254,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1322,7 +1314,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1449,7 +1441,7 @@ async def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1555,7 +1547,7 @@ async def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_operations.py
index 8a78a612fd32e..dc10bf6a49f68 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_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
@@ -31,7 +30,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]]
@@ -71,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-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,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_private_endpoint_connections_operations.py
index d67e59fb027bd..ef641f090bd3c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_private_endpoint_connections_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_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, AsyncIterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -40,7 +41,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 +91,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -247,7 +248,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -296,11 +297,7 @@ async def create_or_update(
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("PrivateEndpointConnection", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -310,7 +307,7 @@ async def create_or_update(
async def _delete_initial(
self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -335,6 +332,7 @@ async def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -343,19 +341,15 @@ async def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -441,7 +435,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_private_link_resources_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_private_link_resources_operations.py
index 4d27e0bf56bf1..eb55901d70303 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_private_link_resources_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_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,
@@ -29,7 +28,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]]
@@ -71,7 +70,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.PrivateLinkResourcesListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_schema_registry_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_schema_registry_operations.py
index 6137d843ef728..97d855d88809c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_schema_registry_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/aio/operations/_schema_registry_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -38,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]]
@@ -96,7 +95,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.SchemaGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -243,7 +242,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.SchemaGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -300,7 +299,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, namespace_name: str, schema_group_name: str, **kwargs: Any
) -> None:
"""Deletes an EventHub schema group.
@@ -315,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,
@@ -371,7 +370,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.SchemaGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/__init__.py
index 5aec26307c319..eee2287672398 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/__init__.py
@@ -5,82 +5,93 @@
# 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 AccessKeys
-from ._models_py3 import ArmDisasterRecovery
-from ._models_py3 import ArmDisasterRecoveryListResult
-from ._models_py3 import AuthorizationRule
-from ._models_py3 import AuthorizationRuleListResult
-from ._models_py3 import AvailableCluster
-from ._models_py3 import AvailableClustersList
-from ._models_py3 import CaptureDescription
-from ._models_py3 import CheckNameAvailabilityParameter
-from ._models_py3 import CheckNameAvailabilityResult
-from ._models_py3 import Cluster
-from ._models_py3 import ClusterListResult
-from ._models_py3 import ClusterQuotaConfigurationProperties
-from ._models_py3 import ClusterSku
-from ._models_py3 import ConnectionState
-from ._models_py3 import ConsumerGroup
-from ._models_py3 import ConsumerGroupListResult
-from ._models_py3 import Destination
-from ._models_py3 import EHNamespace
-from ._models_py3 import EHNamespaceIdContainer
-from ._models_py3 import EHNamespaceIdListResult
-from ._models_py3 import EHNamespaceListResult
-from ._models_py3 import Encryption
-from ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
-from ._models_py3 import EventHubListResult
-from ._models_py3 import Eventhub
-from ._models_py3 import Identity
-from ._models_py3 import KeyVaultProperties
-from ._models_py3 import NWRuleSetIpRules
-from ._models_py3 import NWRuleSetVirtualNetworkRules
-from ._models_py3 import NetworkRuleSet
-from ._models_py3 import NetworkRuleSetListResult
-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 PrivateLinkResourcesListResult
-from ._models_py3 import ProxyResource
-from ._models_py3 import RegenerateAccessKeyParameters
-from ._models_py3 import Resource
-from ._models_py3 import SchemaGroup
-from ._models_py3 import SchemaGroupListResult
-from ._models_py3 import Sku
-from ._models_py3 import Subnet
-from ._models_py3 import SystemData
-from ._models_py3 import TrackedResource
-from ._models_py3 import UserAssignedIdentity
-from ._models_py3 import UserAssignedIdentityProperties
+from typing import TYPE_CHECKING
-from ._event_hub_management_client_enums import AccessRights
-from ._event_hub_management_client_enums import ClusterSkuName
-from ._event_hub_management_client_enums import CreatedByType
-from ._event_hub_management_client_enums import DefaultAction
-from ._event_hub_management_client_enums import EncodingCaptureDescription
-from ._event_hub_management_client_enums import EndPointProvisioningState
-from ._event_hub_management_client_enums import EntityStatus
-from ._event_hub_management_client_enums import KeyType
-from ._event_hub_management_client_enums import ManagedServiceIdentityType
-from ._event_hub_management_client_enums import NetworkRuleIPAction
-from ._event_hub_management_client_enums import PrivateLinkConnectionStatus
-from ._event_hub_management_client_enums import ProvisioningStateDR
-from ._event_hub_management_client_enums import PublicNetworkAccessFlag
-from ._event_hub_management_client_enums import RoleDisasterRecovery
-from ._event_hub_management_client_enums import SchemaCompatibility
-from ._event_hub_management_client_enums import SchemaType
-from ._event_hub_management_client_enums import SkuName
-from ._event_hub_management_client_enums import SkuTier
-from ._event_hub_management_client_enums import UnavailableReason
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ AccessKeys,
+ ArmDisasterRecovery,
+ ArmDisasterRecoveryListResult,
+ AuthorizationRule,
+ AuthorizationRuleListResult,
+ AvailableCluster,
+ AvailableClustersList,
+ CaptureDescription,
+ CheckNameAvailabilityParameter,
+ CheckNameAvailabilityResult,
+ Cluster,
+ ClusterListResult,
+ ClusterQuotaConfigurationProperties,
+ ClusterSku,
+ ConnectionState,
+ ConsumerGroup,
+ ConsumerGroupListResult,
+ Destination,
+ EHNamespace,
+ EHNamespaceIdContainer,
+ EHNamespaceIdListResult,
+ EHNamespaceListResult,
+ Encryption,
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ EventHubListResult,
+ Eventhub,
+ Identity,
+ KeyVaultProperties,
+ NWRuleSetIpRules,
+ NWRuleSetVirtualNetworkRules,
+ NetworkRuleSet,
+ NetworkRuleSetListResult,
+ Operation,
+ OperationDisplay,
+ OperationListResult,
+ PrivateEndpoint,
+ PrivateEndpointConnection,
+ PrivateEndpointConnectionListResult,
+ PrivateLinkResource,
+ PrivateLinkResourcesListResult,
+ ProxyResource,
+ RegenerateAccessKeyParameters,
+ Resource,
+ SchemaGroup,
+ SchemaGroupListResult,
+ Sku,
+ Subnet,
+ SystemData,
+ TrackedResource,
+ UserAssignedIdentity,
+ UserAssignedIdentityProperties,
+)
+
+from ._event_hub_management_client_enums import ( # type: ignore
+ AccessRights,
+ ClusterSkuName,
+ CreatedByType,
+ DefaultAction,
+ EncodingCaptureDescription,
+ EndPointProvisioningState,
+ EntityStatus,
+ KeyType,
+ ManagedServiceIdentityType,
+ NetworkRuleIPAction,
+ PrivateLinkConnectionStatus,
+ ProvisioningStateDR,
+ PublicNetworkAccessFlag,
+ RoleDisasterRecovery,
+ SchemaCompatibility,
+ SchemaType,
+ SkuName,
+ SkuTier,
+ UnavailableReason,
+)
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__ = [
@@ -157,5 +168,5 @@
"SkuTier",
"UnavailableReason",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/_models_py3.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/_models_py3.py
index 10c24a2b1d730..9df1101120610 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/models/_models_py3.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_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.
@@ -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
@@ -577,7 +576,7 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s
self.tags = tags
-class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes
+class Cluster(TrackedResource):
"""Single Event Hubs Cluster resource in List or Get operations.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -945,7 +944,7 @@ def __init__(
self.data_lake_folder_path = data_lake_folder_path
-class EHNamespace(TrackedResource): # pylint: disable=too-many-instance-attributes
+class EHNamespace(TrackedResource):
"""Single Namespace item in List or Get Operation.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1324,7 +1323,7 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A
self.error = error
-class Eventhub(ProxyResource): # pylint: disable=too-many-instance-attributes
+class Eventhub(ProxyResource):
"""Single item in List or Get Event Hub operation.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -2118,7 +2117,7 @@ def __init__(self, *, key_type: Union[str, "_models.KeyType"], key: Optional[str
self.key = key
-class SchemaGroup(ProxyResource): # pylint: disable=too-many-instance-attributes
+class SchemaGroup(ProxyResource):
"""Single item in List or Get Schema Group operation.
Variables are only populated by the server, and will be ignored when sending a request.
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/__init__.py
index 9e81c0df7873d..a378c3a80ea93 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/__init__.py
@@ -5,20 +5,26 @@
# 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 ._clusters_operations import ClustersOperations
-from ._configuration_operations import ConfigurationOperations
-from ._namespaces_operations import NamespacesOperations
-from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
-from ._private_link_resources_operations import PrivateLinkResourcesOperations
-from ._operations import Operations
-from ._event_hubs_operations import EventHubsOperations
-from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations
-from ._consumer_groups_operations import ConsumerGroupsOperations
-from ._schema_registry_operations import SchemaRegistryOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._clusters_operations import ClustersOperations # type: ignore
+from ._configuration_operations import ConfigurationOperations # type: ignore
+from ._namespaces_operations import NamespacesOperations # type: ignore
+from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore
+from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore
+from ._operations import Operations # type: ignore
+from ._event_hubs_operations import EventHubsOperations # type: ignore
+from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations # type: ignore
+from ._consumer_groups_operations import ConsumerGroupsOperations # type: ignore
+from ._schema_registry_operations import SchemaRegistryOperations # 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__ = [
@@ -33,5 +39,5 @@
"ConsumerGroupsOperations",
"SchemaRegistryOperations",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_clusters_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_clusters_operations.py
index 71a75c6d52d0b..add6b0769266a 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_clusters_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_clusters_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, Iterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -321,7 +323,7 @@ def list_available_cluster_region(self, **kwargs: Any) -> _models.AvailableClust
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AvailableClustersList
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -376,7 +378,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Cluster"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -453,7 +455,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-11-01"))
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -527,7 +529,7 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.Cluster
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -573,7 +575,7 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo
def _create_or_update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -609,6 +611,7 @@ def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -617,19 +620,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -755,7 +754,7 @@ def get_long_running_output(pipeline_response):
def _update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -791,6 +790,7 @@ def _update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -799,19 +799,15 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -935,7 +931,7 @@ def get_long_running_output(pipeline_response):
)
def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -959,6 +955,7 @@ def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs:
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -967,19 +964,15 @@ def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs:
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1052,7 +1045,7 @@ def list_namespaces(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.EHNamespaceIdListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_configuration_operations.py
index 451e8bac76188..834d3abb27a51 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_configuration_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_configuration_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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,
@@ -30,7 +29,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -202,7 +201,7 @@ def patch(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.ClusterQuotaConfigurationProperties or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -251,11 +250,7 @@ def patch(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
+ deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -277,7 +272,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.ClusterQuotaConfigurationProperties
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_consumer_groups_operations.py
index 6623d622bf71e..570b698abbced 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_consumer_groups_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_consumer_groups_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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 (
@@ -32,7 +31,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -353,7 +352,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -433,7 +432,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,
@@ -497,7 +496,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -578,7 +577,7 @@ def list_by_event_hub(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.ConsumerGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_disaster_recovery_configs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_disaster_recovery_configs_operations.py
index 1d29f156d4175..ee70cddecf248 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_disaster_recovery_configs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_disaster_recovery_configs_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 (
@@ -32,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -564,7 +564,7 @@ def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -640,7 +640,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -787,7 +787,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.ArmDisasterRecovery or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -861,7 +861,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,
@@ -917,7 +917,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -978,7 +978,7 @@ def break_pairing( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1034,7 +1034,7 @@ def fail_over( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1096,7 +1096,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1178,7 +1178,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1241,7 +1241,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_event_hubs_operations.py
index 2ad75aaffe1dd..1b08d8fc4278c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_event_hubs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_event_hubs_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 (
@@ -32,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -560,7 +560,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -707,7 +707,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -779,7 +779,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,
@@ -835,7 +835,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -901,7 +901,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1059,7 +1059,7 @@ def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1139,7 +1139,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1207,7 +1207,7 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1271,7 +1271,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1411,7 +1411,7 @@ def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_namespaces_operations.py
index 4330f76ad7b94..069573b7e0037 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_namespaces_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_namespaces_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, Iterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -709,7 +711,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.EHNamespace"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -786,7 +788,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-11-01"))
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -855,7 +857,7 @@ def _create_or_update_initial(
parameters: Union[_models.EHNamespace, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -891,6 +893,7 @@ def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -899,19 +902,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1045,7 +1044,7 @@ def get_long_running_output(pipeline_response):
)
def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1069,6 +1068,7 @@ def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwarg
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -1077,19 +1077,15 @@ def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwarg
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1161,7 +1157,7 @@ def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.EHNamespace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1280,7 +1276,7 @@ def update(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.EHNamespace or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1329,11 +1325,7 @@ def update(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
+ deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1413,7 +1405,7 @@ def create_or_update_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1482,7 +1474,7 @@ def get_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1539,7 +1531,7 @@ def list_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.NetworkRuleSetListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1602,7 +1594,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1747,7 +1739,7 @@ def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1819,7 +1811,7 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1875,7 +1867,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1935,7 +1927,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2062,7 +2054,7 @@ def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2168,7 +2160,7 @@ def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_operations.py
index 1d6c1a0157e63..e258dc5131cf1 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_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 (
@@ -31,7 +30,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -92,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-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,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_private_endpoint_connections_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_private_endpoint_connections_operations.py
index ffbe43bfa339b..118bfb3bf4d52 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_private_endpoint_connections_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_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, Iterator, 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,6 +16,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,7 +35,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -271,7 +272,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -428,7 +429,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -477,11 +478,7 @@ def create_or_update(
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("PrivateEndpointConnection", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -491,7 +488,7 @@ def create_or_update(
def _delete_initial(
self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -516,6 +513,7 @@ def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -524,19 +522,15 @@ def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -622,7 +616,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_private_link_resources_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_private_link_resources_operations.py
index b79fa5beaff89..284af132e53c8 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_private_link_resources_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_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,
@@ -29,7 +28,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -114,7 +113,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.PrivateLinkResourcesListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_schema_registry_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_schema_registry_operations.py
index 9b9cdd5c1b44c..af88105aa6e94 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_schema_registry_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_11_01/operations/_schema_registry_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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 (
@@ -32,7 +31,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -268,7 +267,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-11-01"))
cls: ClsType[_models.SchemaGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -415,7 +414,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.SchemaGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -487,7 +486,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,
@@ -543,7 +542,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2021_11_01.models.SchemaGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/__init__.py
index 7fb5add1ee3c8..2c8cfb26ae171 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_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 ._event_hub_management_client import EventHubManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._event_hub_management_client import EventHubManagementClient # 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__ = [
"EventHubManagementClient",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/_configuration.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/_configuration.py
index c77f248555563..a8b428ded6da7 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/_configuration.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_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 EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+class EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for EventHubManagementClient.
Note that all parameters used to create this instance are saved as instance
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/_event_hub_management_client.py
index 2f4fcd0f6c86c..8db31c7b81417 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/_event_hub_management_client.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/_event_hub_management_client.py
@@ -35,11 +35,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class EventHubManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class EventHubManagementClient: # pylint: disable=too-many-instance-attributes
"""Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules
resources.
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/_version.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/_version.py
index 3767c560d3516..e5754a47ce68f 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/_version.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "11.1.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/__init__.py
index 699f917e93165..3cca02660c65c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_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 ._event_hub_management_client import EventHubManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._event_hub_management_client import EventHubManagementClient # 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__ = [
"EventHubManagementClient",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/_configuration.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/_configuration.py
index 6fa3a15337068..fd9142fd89861 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/_configuration.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_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 EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+class EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for EventHubManagementClient.
Note that all parameters used to create this instance are saved as instance
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/_event_hub_management_client.py
index cb266b3fc5bc5..24e8779ed2f59 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/_event_hub_management_client.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/_event_hub_management_client.py
@@ -35,11 +35,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class EventHubManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class EventHubManagementClient: # pylint: disable=too-many-instance-attributes
"""Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules
resources.
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/__init__.py
index df31dad29631d..e13b4bfcc1d61 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/__init__.py
@@ -5,23 +5,29 @@
# 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 ._clusters_operations import ClustersOperations
-from ._namespaces_operations import NamespacesOperations
-from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
-from ._private_link_resources_operations import PrivateLinkResourcesOperations
-from ._network_security_perimeter_configuration_operations import NetworkSecurityPerimeterConfigurationOperations
-from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations
-from ._configuration_operations import ConfigurationOperations
-from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations
-from ._event_hubs_operations import EventHubsOperations
-from ._consumer_groups_operations import ConsumerGroupsOperations
-from ._operations import Operations
-from ._schema_registry_operations import SchemaRegistryOperations
-from ._application_group_operations import ApplicationGroupOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._clusters_operations import ClustersOperations # type: ignore
+from ._namespaces_operations import NamespacesOperations # type: ignore
+from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore
+from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore
+from ._network_security_perimeter_configuration_operations import NetworkSecurityPerimeterConfigurationOperations # type: ignore
+from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore
+from ._configuration_operations import ConfigurationOperations # type: ignore
+from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations # type: ignore
+from ._event_hubs_operations import EventHubsOperations # type: ignore
+from ._consumer_groups_operations import ConsumerGroupsOperations # type: ignore
+from ._operations import Operations # type: ignore
+from ._schema_registry_operations import SchemaRegistryOperations # type: ignore
+from ._application_group_operations import ApplicationGroupOperations # 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__ = [
@@ -39,5 +45,5 @@
"SchemaRegistryOperations",
"ApplicationGroupOperations",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_application_group_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_application_group_operations.py
index ee74704657431..7038b23cc67b0 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_application_group_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_application_group_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -38,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 +85,7 @@ def list_by_namespace(
)
cls: ClsType[_models.ApplicationGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -231,7 +230,7 @@ async def create_or_update_application_group(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.ApplicationGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -290,7 +289,7 @@ async def create_or_update_application_group(
return deserialized # type: ignore
@distributed_trace_async
- async def delete( # pylint: disable=inconsistent-return-statements
+ async def delete(
self, resource_group_name: str, namespace_name: str, application_group_name: str, **kwargs: Any
) -> None:
"""Deletes an ApplicationGroup for a Namespace.
@@ -305,7 +304,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,
@@ -363,7 +362,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.ApplicationGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_clusters_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_clusters_operations.py
index 0d85966a05739..b316dd0ff6a30 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_clusters_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_clusters_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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, AsyncIterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -44,7 +45,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]]
@@ -77,7 +78,7 @@ async def list_available_cluster_region(self, **kwargs: Any) -> _models.Availabl
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AvailableClustersList
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -137,7 +138,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Cluster"
)
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -217,7 +218,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy
)
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -291,7 +292,7 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any)
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.Cluster
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -339,7 +340,7 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any)
async def _create_or_update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -377,6 +378,7 @@ async def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -385,19 +387,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -531,7 +529,7 @@ def get_long_running_output(pipeline_response):
async def _update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -569,6 +567,7 @@ async def _update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -577,19 +576,15 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -721,7 +716,7 @@ def get_long_running_output(pipeline_response):
)
async def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -747,6 +742,7 @@ async def _delete_initial(self, resource_group_name: str, cluster_name: str, **k
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -755,19 +751,15 @@ async def _delete_initial(self, resource_group_name: str, cluster_name: str, **k
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -842,7 +834,7 @@ async def list_namespaces(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.EHNamespaceIdListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_configuration_operations.py
index 60b3888e26b4b..54ddfe9efd6f7 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_configuration_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_configuration_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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,
@@ -30,7 +29,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 +136,7 @@ async def patch(
None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -188,11 +187,7 @@ async def patch(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
+ deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -214,7 +209,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.ClusterQuotaConfigurationProperties
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_consumer_groups_operations.py
index 1b030937fdf6f..3085726757005 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_consumer_groups_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_consumer_groups_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -38,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]]
@@ -154,7 +153,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -214,7 +213,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,
namespace_name: str,
@@ -236,7 +235,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 +301,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -388,7 +387,7 @@ def list_by_event_hub(
)
cls: ClsType[_models.ConsumerGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py
index 9f2a9c2dda580..05edd01b5751d 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_disaster_recovery_configs_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -44,7 +43,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]]
@@ -94,7 +93,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -176,7 +175,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -241,7 +240,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -363,7 +362,7 @@ async def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -443,7 +442,7 @@ def list(
)
cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -591,7 +590,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -642,11 +641,7 @@ async def create_or_update(
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("ArmDisasterRecovery", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response.http_response)
+ deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -654,9 +649,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, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def delete(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""Deletes an Alias(Disaster Recovery configuration).
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -669,7 +662,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,
@@ -727,7 +720,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -774,9 +767,7 @@ async def get(
return deserialized # type: ignore
@distributed_trace_async
- async def break_pairing( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def break_pairing(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""This operation disables the Disaster Recovery and stops replicating changes from primary to
secondary namespaces.
@@ -790,7 +781,7 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -833,9 +824,7 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements
return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def fail_over( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def fail_over(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace.
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -848,7 +837,7 @@ async def fail_over( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_event_hubs_operations.py
index 7f8f026e734a6..da07193b45ee2 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_event_hubs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_event_hubs_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
@@ -44,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]]
@@ -94,7 +94,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -253,7 +253,7 @@ async def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -335,7 +335,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -383,7 +383,7 @@ async def get_authorization_rule(
return deserialized # type: ignore
@distributed_trace_async
- async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
+ async def delete_authorization_rule(
self,
resource_group_name: str,
namespace_name: str,
@@ -405,7 +405,7 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -471,7 +471,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -613,7 +613,7 @@ async def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -707,7 +707,7 @@ def list_by_namespace(
)
cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -854,7 +854,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -913,9 +913,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, namespace_name: str, event_hub_name: str, **kwargs: Any
- ) -> None:
+ async def delete(self, resource_group_name: str, namespace_name: str, event_hub_name: str, **kwargs: Any) -> None:
"""Deletes an Event Hub from the specified Namespace and resource group.
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -928,7 +926,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,
@@ -986,7 +984,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_namespaces_operations.py
index a670a7053ba7a..4f6082461eb9c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_namespaces_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_namespaces_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, AsyncIterator, 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,6 +18,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -52,7 +54,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]]
@@ -94,7 +96,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.EHNamespace"]:
)
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -174,7 +176,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy
)
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -243,7 +245,7 @@ async def _create_or_update_initial(
parameters: Union[_models.EHNamespace, IO[bytes]],
**kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -281,6 +283,7 @@ async def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -289,19 +292,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -442,7 +441,7 @@ def get_long_running_output(pipeline_response):
async def _delete_initial(
self, resource_group_name: str, namespace_name: str, **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -468,6 +467,7 @@ async def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -476,19 +476,15 @@ async def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -562,7 +558,7 @@ async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.EHNamespace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -683,7 +679,7 @@ async def update(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.EHNamespace or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -734,11 +730,7 @@ async def update(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
+ deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -818,7 +810,7 @@ async def create_or_update_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -889,7 +881,7 @@ async def get_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -948,7 +940,7 @@ async def list_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.NetworkRuleSetListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1016,7 +1008,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1162,7 +1154,7 @@ async def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1221,7 +1213,7 @@ async def create_or_update_authorization_rule(
return deserialized # type: ignore
@distributed_trace_async
- async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
+ async def delete_authorization_rule(
self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any
) -> None:
"""Deletes an AuthorizationRule for a Namespace.
@@ -1236,7 +1228,7 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1294,7 +1286,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1356,7 +1348,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1485,7 +1477,7 @@ async def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1594,7 +1586,7 @@ async def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_network_security_perimeter_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_network_security_perimeter_configuration_operations.py
index c4afd19a12353..5395774effd4e 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_network_security_perimeter_configuration_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_network_security_perimeter_configuration_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,
@@ -29,7 +28,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,7 +68,7 @@ async def list(
~azure.mgmt.eventhub.v2022_01_01_preview.models.NetworkSecurityPerimeterConfigurationList
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_network_security_perimeter_configurations_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_network_security_perimeter_configurations_operations.py
index 3c2ecb52af75b..cb1080eba0641 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_network_security_perimeter_configurations_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/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, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast
+from typing import Any, AsyncIterator, Callable, Dict, Optional, TypeVar, Union, cast
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -15,6 +14,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -31,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]]
@@ -59,7 +60,7 @@ def __init__(self, *args, **kwargs) -> None:
async def _create_or_update_initial(
self, resource_group_name: str, namespace_name: str, resource_association_name: str, **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -86,6 +87,7 @@ async def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -94,16 +96,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_operations.py
index 968e8bcd6ba5f..daae951eabd31 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_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
@@ -31,7 +30,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]]
@@ -73,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,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_private_endpoint_connections_operations.py
index aebd1c9b37c34..e586f79d072fd 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_private_endpoint_connections_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_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, AsyncIterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -40,7 +41,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 +70,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, resource_group_name: str, namespace_name: str, **kwargs: Any
) -> AsyncIterable["_models.PrivateEndpointConnection"]:
+ # pylint: disable=line-too-long
"""Gets the available PrivateEndpointConnections within a namespace.
.. seealso::
@@ -92,7 +94,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,
@@ -249,7 +251,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -300,14 +302,7 @@ async def create_or_update(
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("PrivateEndpointConnection", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -317,7 +312,7 @@ async def create_or_update(
async def _delete_initial(
self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -344,6 +339,7 @@ async def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -352,19 +348,15 @@ async def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -452,7 +444,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_private_link_resources_operations.py
index eb30cd073ffc1..cdb0f568b12a0 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_private_link_resources_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_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,
@@ -29,7 +28,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]]
@@ -71,7 +70,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.PrivateLinkResourcesListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_schema_registry_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_schema_registry_operations.py
index 835138bcba29c..3419c14e862f1 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_schema_registry_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/aio/operations/_schema_registry_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -38,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]]
@@ -98,7 +97,7 @@ def list_by_namespace(
)
cls: ClsType[_models.SchemaGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -245,7 +244,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.SchemaGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -304,7 +303,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, namespace_name: str, schema_group_name: str, **kwargs: Any
) -> None:
"""Deletes an EventHub schema group.
@@ -319,7 +318,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,
@@ -377,7 +376,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.SchemaGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/models/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/models/__init__.py
index f8118705fa497..9618ef948758b 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/models/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/models/__init__.py
@@ -5,103 +5,114 @@
# 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 AccessKeys
-from ._models_py3 import ApplicationGroup
-from ._models_py3 import ApplicationGroupListResult
-from ._models_py3 import ApplicationGroupPolicy
-from ._models_py3 import ArmDisasterRecovery
-from ._models_py3 import ArmDisasterRecoveryListResult
-from ._models_py3 import AuthorizationRule
-from ._models_py3 import AuthorizationRuleListResult
-from ._models_py3 import AvailableCluster
-from ._models_py3 import AvailableClustersList
-from ._models_py3 import CaptureDescription
-from ._models_py3 import CheckNameAvailabilityParameter
-from ._models_py3 import CheckNameAvailabilityResult
-from ._models_py3 import Cluster
-from ._models_py3 import ClusterListResult
-from ._models_py3 import ClusterQuotaConfigurationProperties
-from ._models_py3 import ClusterSku
-from ._models_py3 import ConnectionState
-from ._models_py3 import ConsumerGroup
-from ._models_py3 import ConsumerGroupListResult
-from ._models_py3 import Destination
-from ._models_py3 import EHNamespace
-from ._models_py3 import EHNamespaceIdContainer
-from ._models_py3 import EHNamespaceIdListResult
-from ._models_py3 import EHNamespaceListResult
-from ._models_py3 import Encryption
-from ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
-from ._models_py3 import EventHubListResult
-from ._models_py3 import Eventhub
-from ._models_py3 import Identity
-from ._models_py3 import KeyVaultProperties
-from ._models_py3 import NWRuleSetIpRules
-from ._models_py3 import NWRuleSetVirtualNetworkRules
-from ._models_py3 import NetworkRuleSet
-from ._models_py3 import NetworkRuleSetListResult
-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 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 PrivateLinkResourcesListResult
-from ._models_py3 import ProvisioningIssue
-from ._models_py3 import ProvisioningIssueProperties
-from ._models_py3 import ProxyResource
-from ._models_py3 import RegenerateAccessKeyParameters
-from ._models_py3 import Resource
-from ._models_py3 import SchemaGroup
-from ._models_py3 import SchemaGroupListResult
-from ._models_py3 import Sku
-from ._models_py3 import Subnet
-from ._models_py3 import SystemData
-from ._models_py3 import ThrottlingPolicy
-from ._models_py3 import TrackedResource
-from ._models_py3 import UserAssignedIdentity
-from ._models_py3 import UserAssignedIdentityProperties
+from typing import TYPE_CHECKING
-from ._event_hub_management_client_enums import AccessRights
-from ._event_hub_management_client_enums import ApplicationGroupPolicyType
-from ._event_hub_management_client_enums import ClusterSkuName
-from ._event_hub_management_client_enums import CreatedByType
-from ._event_hub_management_client_enums import DefaultAction
-from ._event_hub_management_client_enums import EncodingCaptureDescription
-from ._event_hub_management_client_enums import EndPointProvisioningState
-from ._event_hub_management_client_enums import EntityStatus
-from ._event_hub_management_client_enums import KeyType
-from ._event_hub_management_client_enums import ManagedServiceIdentityType
-from ._event_hub_management_client_enums import MetricId
-from ._event_hub_management_client_enums import NetworkRuleIPAction
-from ._event_hub_management_client_enums import NetworkSecurityPerimeterConfigurationProvisioningState
-from ._event_hub_management_client_enums import NspAccessRuleDirection
-from ._event_hub_management_client_enums import PrivateLinkConnectionStatus
-from ._event_hub_management_client_enums import ProvisioningStateDR
-from ._event_hub_management_client_enums import PublicNetworkAccess
-from ._event_hub_management_client_enums import PublicNetworkAccessFlag
-from ._event_hub_management_client_enums import ResourceAssociationAccessMode
-from ._event_hub_management_client_enums import RoleDisasterRecovery
-from ._event_hub_management_client_enums import SchemaCompatibility
-from ._event_hub_management_client_enums import SchemaType
-from ._event_hub_management_client_enums import SkuName
-from ._event_hub_management_client_enums import SkuTier
-from ._event_hub_management_client_enums import TlsVersion
-from ._event_hub_management_client_enums import UnavailableReason
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ AccessKeys,
+ ApplicationGroup,
+ ApplicationGroupListResult,
+ ApplicationGroupPolicy,
+ ArmDisasterRecovery,
+ ArmDisasterRecoveryListResult,
+ AuthorizationRule,
+ AuthorizationRuleListResult,
+ AvailableCluster,
+ AvailableClustersList,
+ CaptureDescription,
+ CheckNameAvailabilityParameter,
+ CheckNameAvailabilityResult,
+ Cluster,
+ ClusterListResult,
+ ClusterQuotaConfigurationProperties,
+ ClusterSku,
+ ConnectionState,
+ ConsumerGroup,
+ ConsumerGroupListResult,
+ Destination,
+ EHNamespace,
+ EHNamespaceIdContainer,
+ EHNamespaceIdListResult,
+ EHNamespaceListResult,
+ Encryption,
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ EventHubListResult,
+ Eventhub,
+ Identity,
+ KeyVaultProperties,
+ NWRuleSetIpRules,
+ NWRuleSetVirtualNetworkRules,
+ NetworkRuleSet,
+ NetworkRuleSetListResult,
+ NetworkSecurityPerimeter,
+ NetworkSecurityPerimeterConfiguration,
+ NetworkSecurityPerimeterConfigurationList,
+ NetworkSecurityPerimeterConfigurationPropertiesProfile,
+ NetworkSecurityPerimeterConfigurationPropertiesResourceAssociation,
+ NspAccessRule,
+ NspAccessRuleProperties,
+ NspAccessRulePropertiesSubscriptionsItem,
+ Operation,
+ OperationDisplay,
+ OperationListResult,
+ PrivateEndpoint,
+ PrivateEndpointConnection,
+ PrivateEndpointConnectionListResult,
+ PrivateLinkResource,
+ PrivateLinkResourcesListResult,
+ ProvisioningIssue,
+ ProvisioningIssueProperties,
+ ProxyResource,
+ RegenerateAccessKeyParameters,
+ Resource,
+ SchemaGroup,
+ SchemaGroupListResult,
+ Sku,
+ Subnet,
+ SystemData,
+ ThrottlingPolicy,
+ TrackedResource,
+ UserAssignedIdentity,
+ UserAssignedIdentityProperties,
+)
+
+from ._event_hub_management_client_enums import ( # type: ignore
+ AccessRights,
+ ApplicationGroupPolicyType,
+ ClusterSkuName,
+ CreatedByType,
+ DefaultAction,
+ EncodingCaptureDescription,
+ EndPointProvisioningState,
+ EntityStatus,
+ KeyType,
+ ManagedServiceIdentityType,
+ MetricId,
+ NetworkRuleIPAction,
+ NetworkSecurityPerimeterConfigurationProvisioningState,
+ NspAccessRuleDirection,
+ PrivateLinkConnectionStatus,
+ ProvisioningStateDR,
+ PublicNetworkAccess,
+ PublicNetworkAccessFlag,
+ ResourceAssociationAccessMode,
+ RoleDisasterRecovery,
+ SchemaCompatibility,
+ SchemaType,
+ SkuName,
+ SkuTier,
+ TlsVersion,
+ UnavailableReason,
+)
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__ = [
@@ -199,5 +210,5 @@
"TlsVersion",
"UnavailableReason",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/models/_models_py3.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/models/_models_py3.py
index e6ea74c0170b5..7ccc78679f274 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/models/_models_py3.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_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
@@ -724,7 +723,7 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s
self.tags = tags
-class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes
+class Cluster(TrackedResource):
"""Single Event Hubs Cluster resource in List or Get operations.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1101,7 +1100,7 @@ def __init__(
self.data_lake_folder_path = data_lake_folder_path
-class EHNamespace(TrackedResource): # pylint: disable=too-many-instance-attributes
+class EHNamespace(TrackedResource):
"""Single Namespace item in List or Get Operation.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1503,7 +1502,7 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A
self.error = error
-class Eventhub(ProxyResource): # pylint: disable=too-many-instance-attributes
+class Eventhub(ProxyResource):
"""Single item in List or Get Event Hub operation.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -2732,7 +2731,7 @@ def __init__(self, *, key_type: Union[str, "_models.KeyType"], key: Optional[str
self.key = key
-class SchemaGroup(ProxyResource): # pylint: disable=too-many-instance-attributes
+class SchemaGroup(ProxyResource):
"""Single item in List or Get Schema Group operation.
Variables are only populated by the server, and will be ignored when sending a request.
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/__init__.py
index df31dad29631d..e13b4bfcc1d61 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/__init__.py
@@ -5,23 +5,29 @@
# 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 ._clusters_operations import ClustersOperations
-from ._namespaces_operations import NamespacesOperations
-from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
-from ._private_link_resources_operations import PrivateLinkResourcesOperations
-from ._network_security_perimeter_configuration_operations import NetworkSecurityPerimeterConfigurationOperations
-from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations
-from ._configuration_operations import ConfigurationOperations
-from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations
-from ._event_hubs_operations import EventHubsOperations
-from ._consumer_groups_operations import ConsumerGroupsOperations
-from ._operations import Operations
-from ._schema_registry_operations import SchemaRegistryOperations
-from ._application_group_operations import ApplicationGroupOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._clusters_operations import ClustersOperations # type: ignore
+from ._namespaces_operations import NamespacesOperations # type: ignore
+from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore
+from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore
+from ._network_security_perimeter_configuration_operations import NetworkSecurityPerimeterConfigurationOperations # type: ignore
+from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore
+from ._configuration_operations import ConfigurationOperations # type: ignore
+from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations # type: ignore
+from ._event_hubs_operations import EventHubsOperations # type: ignore
+from ._consumer_groups_operations import ConsumerGroupsOperations # type: ignore
+from ._operations import Operations # type: ignore
+from ._schema_registry_operations import SchemaRegistryOperations # type: ignore
+from ._application_group_operations import ApplicationGroupOperations # 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__ = [
@@ -39,5 +45,5 @@
"SchemaRegistryOperations",
"ApplicationGroupOperations",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_application_group_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_application_group_operations.py
index a3cac30280bab..5d3cae2b8097e 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_application_group_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_application_group_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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 (
@@ -32,7 +31,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -255,7 +254,7 @@ def list_by_namespace(
)
cls: ClsType[_models.ApplicationGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -400,7 +399,7 @@ def create_or_update_application_group(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.ApplicationGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -474,7 +473,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,
@@ -532,7 +531,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.ApplicationGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_clusters_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_clusters_operations.py
index 43ea295182374..f22c0db34dbaa 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_clusters_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_clusters_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, Iterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -321,7 +323,7 @@ def list_available_cluster_region(self, **kwargs: Any) -> _models.AvailableClust
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AvailableClustersList
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -380,7 +382,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Cluster"]:
)
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -459,7 +461,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite
)
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -533,7 +535,7 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.Cluster
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -581,7 +583,7 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo
def _create_or_update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -619,6 +621,7 @@ def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -627,19 +630,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -767,7 +766,7 @@ def get_long_running_output(pipeline_response):
def _update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -805,6 +804,7 @@ def _update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -813,19 +813,15 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -951,7 +947,7 @@ def get_long_running_output(pipeline_response):
)
def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -977,6 +973,7 @@ def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs:
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -985,19 +982,15 @@ def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs:
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1072,7 +1065,7 @@ def list_namespaces(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.EHNamespaceIdListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_configuration_operations.py
index 4e37b5632dfb0..4cd226694b9da 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_configuration_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_configuration_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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,
@@ -30,7 +29,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -207,7 +206,7 @@ def patch(
None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -258,11 +257,7 @@ def patch(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
+ deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -284,7 +279,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.ClusterQuotaConfigurationProperties
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_consumer_groups_operations.py
index 769482dc8dd09..fe6c8948229f6 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_consumer_groups_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_consumer_groups_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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 (
@@ -32,7 +31,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -353,7 +352,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -435,7 +434,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,
@@ -501,7 +500,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -587,7 +586,7 @@ def list_by_event_hub(
)
cls: ClsType[_models.ConsumerGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_disaster_recovery_configs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_disaster_recovery_configs_operations.py
index ff44794a86cdb..0fe735c469a52 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_disaster_recovery_configs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_disaster_recovery_configs_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 (
@@ -32,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -515,7 +515,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -597,7 +597,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -662,7 +662,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -784,7 +784,7 @@ def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -864,7 +864,7 @@ def list(
)
cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1012,7 +1012,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1063,11 +1063,7 @@ def create_or_update(
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("ArmDisasterRecovery", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response.http_response)
+ deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1090,7 +1086,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,
@@ -1148,7 +1144,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1211,7 +1207,7 @@ def break_pairing( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1269,7 +1265,7 @@ def fail_over( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_event_hubs_operations.py
index 756a4101597a5..793711272c174 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_event_hubs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_event_hubs_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 (
@@ -32,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -553,7 +553,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -712,7 +712,7 @@ def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -794,7 +794,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -864,7 +864,7 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -930,7 +930,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1072,7 +1072,7 @@ def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1165,7 +1165,7 @@ def list_by_namespace(
)
cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1312,7 +1312,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1386,7 +1386,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,
@@ -1444,7 +1444,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_namespaces_operations.py
index de89bf0ab794b..24509d94ec741 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_namespaces_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_namespaces_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, Iterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -712,7 +714,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.EHNamespace"]:
)
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -792,7 +794,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite
)
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -861,7 +863,7 @@ def _create_or_update_initial(
parameters: Union[_models.EHNamespace, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -899,6 +901,7 @@ def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -907,19 +910,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1058,7 +1057,7 @@ def get_long_running_output(pipeline_response):
)
def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1084,6 +1083,7 @@ def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwarg
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -1092,19 +1092,15 @@ def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwarg
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1178,7 +1174,7 @@ def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.EHNamespace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1299,7 +1295,7 @@ def update(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.EHNamespace or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1350,11 +1346,7 @@ def update(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
+ deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1434,7 +1426,7 @@ def create_or_update_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1505,7 +1497,7 @@ def get_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1564,7 +1556,7 @@ def list_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.NetworkRuleSetListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1632,7 +1624,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1778,7 +1770,7 @@ def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1852,7 +1844,7 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1910,7 +1902,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1972,7 +1964,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2101,7 +2093,7 @@ def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2210,7 +2202,7 @@ def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_network_security_perimeter_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_network_security_perimeter_configuration_operations.py
index e5a57a4650154..296e69034a24a 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_network_security_perimeter_configuration_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_network_security_perimeter_configuration_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,
@@ -29,7 +28,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -112,7 +111,7 @@ def list(
~azure.mgmt.eventhub.v2022_01_01_preview.models.NetworkSecurityPerimeterConfigurationList
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_network_security_perimeter_configurations_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_network_security_perimeter_configurations_operations.py
index c4b2ee43bb6e9..ea161baec2599 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_network_security_perimeter_configurations_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/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, Iterator, Optional, Type, TypeVar, Union, cast
+from typing import Any, Callable, Dict, Iterator, Optional, TypeVar, Union, cast
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -15,6 +14,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -31,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -103,7 +104,7 @@ def __init__(self, *args, **kwargs):
def _create_or_update_initial(
self, resource_group_name: str, namespace_name: str, resource_association_name: str, **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -130,6 +131,7 @@ def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -138,16 +140,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_operations.py
index f2545140f3025..9c14660384b39 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_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 (
@@ -31,7 +30,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -94,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,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_private_endpoint_connections_operations.py
index 3dc3b634f3e23..b8bbb81359c8a 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_private_endpoint_connections_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_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, Iterator, 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,6 +16,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,7 +35,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -273,7 +274,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,
@@ -430,7 +431,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -481,14 +482,7 @@ def create_or_update(
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("PrivateEndpointConnection", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -498,7 +492,7 @@ def create_or_update(
def _delete_initial(
self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -525,6 +519,7 @@ def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -533,19 +528,15 @@ def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -633,7 +624,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_private_link_resources_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_private_link_resources_operations.py
index 811a20db7d923..4b3102bad41ea 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_private_link_resources_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_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,
@@ -29,7 +28,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -114,7 +113,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.PrivateLinkResourcesListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_schema_registry_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_schema_registry_operations.py
index b58b607e84571..672429cded9d2 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_schema_registry_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_01_01_preview/operations/_schema_registry_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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 (
@@ -32,7 +31,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -271,7 +270,7 @@ def list_by_namespace(
)
cls: ClsType[_models.SchemaGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -418,7 +417,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.SchemaGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -492,7 +491,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,
@@ -550,7 +549,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2022_01_01_preview.models.SchemaGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/__init__.py
index 7fb5add1ee3c8..2c8cfb26ae171 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_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 ._event_hub_management_client import EventHubManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._event_hub_management_client import EventHubManagementClient # 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__ = [
"EventHubManagementClient",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/_configuration.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/_configuration.py
index 41dda08fb48b6..5a926548bd182 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/_configuration.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_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 EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+class EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for EventHubManagementClient.
Note that all parameters used to create this instance are saved as instance
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/_event_hub_management_client.py
index e1fe991f68a77..361e78f6f1de9 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/_event_hub_management_client.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/_event_hub_management_client.py
@@ -35,11 +35,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class EventHubManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class EventHubManagementClient: # pylint: disable=too-many-instance-attributes
"""Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules
resources.
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/_version.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/_version.py
index 3767c560d3516..e5754a47ce68f 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/_version.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "11.1.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/__init__.py
index 699f917e93165..3cca02660c65c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_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 ._event_hub_management_client import EventHubManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._event_hub_management_client import EventHubManagementClient # 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__ = [
"EventHubManagementClient",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/_configuration.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/_configuration.py
index 0f65ce325076f..b37a0d85c9daa 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/_configuration.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_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 EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+class EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for EventHubManagementClient.
Note that all parameters used to create this instance are saved as instance
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/_event_hub_management_client.py
index 224418d462ce7..7fdc3267dcd72 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/_event_hub_management_client.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/_event_hub_management_client.py
@@ -35,11 +35,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class EventHubManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class EventHubManagementClient: # pylint: disable=too-many-instance-attributes
"""Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules
resources.
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/__init__.py
index df31dad29631d..e13b4bfcc1d61 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/__init__.py
@@ -5,23 +5,29 @@
# 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 ._clusters_operations import ClustersOperations
-from ._namespaces_operations import NamespacesOperations
-from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
-from ._private_link_resources_operations import PrivateLinkResourcesOperations
-from ._network_security_perimeter_configuration_operations import NetworkSecurityPerimeterConfigurationOperations
-from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations
-from ._configuration_operations import ConfigurationOperations
-from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations
-from ._event_hubs_operations import EventHubsOperations
-from ._consumer_groups_operations import ConsumerGroupsOperations
-from ._operations import Operations
-from ._schema_registry_operations import SchemaRegistryOperations
-from ._application_group_operations import ApplicationGroupOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._clusters_operations import ClustersOperations # type: ignore
+from ._namespaces_operations import NamespacesOperations # type: ignore
+from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore
+from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore
+from ._network_security_perimeter_configuration_operations import NetworkSecurityPerimeterConfigurationOperations # type: ignore
+from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore
+from ._configuration_operations import ConfigurationOperations # type: ignore
+from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations # type: ignore
+from ._event_hubs_operations import EventHubsOperations # type: ignore
+from ._consumer_groups_operations import ConsumerGroupsOperations # type: ignore
+from ._operations import Operations # type: ignore
+from ._schema_registry_operations import SchemaRegistryOperations # type: ignore
+from ._application_group_operations import ApplicationGroupOperations # 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__ = [
@@ -39,5 +45,5 @@
"SchemaRegistryOperations",
"ApplicationGroupOperations",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_application_group_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_application_group_operations.py
index 176d96d5fd752..06a4952e0eb5b 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_application_group_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_application_group_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -38,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 +85,7 @@ def list_by_namespace(
)
cls: ClsType[_models.ApplicationGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -231,7 +230,7 @@ async def create_or_update_application_group(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.ApplicationGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -290,7 +289,7 @@ async def create_or_update_application_group(
return deserialized # type: ignore
@distributed_trace_async
- async def delete( # pylint: disable=inconsistent-return-statements
+ async def delete(
self, resource_group_name: str, namespace_name: str, application_group_name: str, **kwargs: Any
) -> None:
"""Deletes an ApplicationGroup for a Namespace.
@@ -305,7 +304,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,
@@ -363,7 +362,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.ApplicationGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_clusters_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_clusters_operations.py
index 31dea6eb32343..046a0ea068617 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_clusters_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_clusters_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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, AsyncIterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -44,7 +45,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]]
@@ -77,7 +78,7 @@ async def list_available_cluster_region(self, **kwargs: Any) -> _models.Availabl
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AvailableClustersList
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -137,7 +138,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Cluster"
)
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -217,7 +218,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy
)
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -291,7 +292,7 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any)
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.Cluster
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -339,7 +340,7 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any)
async def _create_or_update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -377,6 +378,7 @@ async def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -385,19 +387,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -531,7 +529,7 @@ def get_long_running_output(pipeline_response):
async def _update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -569,6 +567,7 @@ async def _update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -577,19 +576,15 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -721,7 +716,7 @@ def get_long_running_output(pipeline_response):
)
async def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -747,6 +742,7 @@ async def _delete_initial(self, resource_group_name: str, cluster_name: str, **k
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -755,19 +751,15 @@ async def _delete_initial(self, resource_group_name: str, cluster_name: str, **k
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -842,7 +834,7 @@ async def list_namespaces(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.EHNamespaceIdListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_configuration_operations.py
index f74688b31dc6e..2b4e4f763688f 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_configuration_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_configuration_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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,
@@ -30,7 +29,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 +136,7 @@ async def patch(
None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -188,11 +187,7 @@ async def patch(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
+ deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -214,7 +209,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.ClusterQuotaConfigurationProperties
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_consumer_groups_operations.py
index 51b893318eeb1..5f9efa2708f5e 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_consumer_groups_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_consumer_groups_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -38,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]]
@@ -154,7 +153,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -214,7 +213,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,
namespace_name: str,
@@ -236,7 +235,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 +301,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -388,7 +387,7 @@ def list_by_event_hub(
)
cls: ClsType[_models.ConsumerGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_disaster_recovery_configs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_disaster_recovery_configs_operations.py
index c5f9fe1c2a274..76e8657ee24b4 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_disaster_recovery_configs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_disaster_recovery_configs_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -44,7 +43,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]]
@@ -94,7 +93,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -176,7 +175,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -241,7 +240,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -363,7 +362,7 @@ async def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -443,7 +442,7 @@ def list(
)
cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -591,7 +590,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -642,11 +641,7 @@ async def create_or_update(
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("ArmDisasterRecovery", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response.http_response)
+ deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -654,9 +649,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, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def delete(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""Deletes an Alias(Disaster Recovery configuration).
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -669,7 +662,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,
@@ -727,7 +720,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -774,9 +767,7 @@ async def get(
return deserialized # type: ignore
@distributed_trace_async
- async def break_pairing( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def break_pairing(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""This operation disables the Disaster Recovery and stops replicating changes from primary to
secondary namespaces.
@@ -790,7 +781,7 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -833,9 +824,7 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements
return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def fail_over( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def fail_over(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace.
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -848,7 +837,7 @@ async def fail_over( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_event_hubs_operations.py
index fa090cc6ccb57..a312e0c859ebe 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_event_hubs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_event_hubs_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
@@ -44,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]]
@@ -94,7 +94,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -253,7 +253,7 @@ async def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -335,7 +335,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -383,7 +383,7 @@ async def get_authorization_rule(
return deserialized # type: ignore
@distributed_trace_async
- async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
+ async def delete_authorization_rule(
self,
resource_group_name: str,
namespace_name: str,
@@ -405,7 +405,7 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -471,7 +471,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -613,7 +613,7 @@ async def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -707,7 +707,7 @@ def list_by_namespace(
)
cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -854,7 +854,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -913,9 +913,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, namespace_name: str, event_hub_name: str, **kwargs: Any
- ) -> None:
+ async def delete(self, resource_group_name: str, namespace_name: str, event_hub_name: str, **kwargs: Any) -> None:
"""Deletes an Event Hub from the specified Namespace and resource group.
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -928,7 +926,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,
@@ -986,7 +984,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_namespaces_operations.py
index d4548354f2779..828e9233dd701 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_namespaces_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_namespaces_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, AsyncIterator, 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,6 +18,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -52,7 +54,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]]
@@ -94,7 +96,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.EHNamespace"]:
)
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -174,7 +176,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy
)
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -243,7 +245,7 @@ async def _create_or_update_initial(
parameters: Union[_models.EHNamespace, IO[bytes]],
**kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -281,6 +283,7 @@ async def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -289,19 +292,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -442,7 +441,7 @@ def get_long_running_output(pipeline_response):
async def _delete_initial(
self, resource_group_name: str, namespace_name: str, **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -468,6 +467,7 @@ async def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -476,19 +476,15 @@ async def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -562,7 +558,7 @@ async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.EHNamespace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -683,7 +679,7 @@ async def update(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.EHNamespace or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -734,11 +730,7 @@ async def update(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
+ deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -818,7 +810,7 @@ async def create_or_update_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -889,7 +881,7 @@ async def get_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -948,7 +940,7 @@ async def list_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.NetworkRuleSetListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1016,7 +1008,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1162,7 +1154,7 @@ async def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1221,7 +1213,7 @@ async def create_or_update_authorization_rule(
return deserialized # type: ignore
@distributed_trace_async
- async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
+ async def delete_authorization_rule(
self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any
) -> None:
"""Deletes an AuthorizationRule for a Namespace.
@@ -1236,7 +1228,7 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1294,7 +1286,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1356,7 +1348,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1485,7 +1477,7 @@ async def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1594,7 +1586,7 @@ async def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_network_security_perimeter_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_network_security_perimeter_configuration_operations.py
index 6f2106ea2d951..d05b0bdd39378 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_network_security_perimeter_configuration_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_network_security_perimeter_configuration_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,
@@ -29,7 +28,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,7 +68,7 @@ async def list(
~azure.mgmt.eventhub.v2022_10_01_preview.models.NetworkSecurityPerimeterConfigurationList
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_network_security_perimeter_configurations_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_network_security_perimeter_configurations_operations.py
index ab0a2e669ce7a..e65b77ec4c7b7 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_network_security_perimeter_configurations_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/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, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast
+from typing import Any, AsyncIterator, Callable, Dict, Optional, TypeVar, Union, cast
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -15,6 +14,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -31,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]]
@@ -59,7 +60,7 @@ def __init__(self, *args, **kwargs) -> None:
async def _create_or_update_initial(
self, resource_group_name: str, namespace_name: str, resource_association_name: str, **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -86,6 +87,7 @@ async def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -94,16 +96,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_operations.py
index 4aefad961f5b0..d26964eb8b4a5 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_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
@@ -31,7 +30,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]]
@@ -73,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,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_private_endpoint_connections_operations.py
index 75c190c42a4f7..3c98e97d1812e 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_private_endpoint_connections_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_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, AsyncIterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -40,7 +41,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 +70,7 @@ def __init__(self, *args, **kwargs) -> None:
def list(
self, resource_group_name: str, namespace_name: str, **kwargs: Any
) -> AsyncIterable["_models.PrivateEndpointConnection"]:
+ # pylint: disable=line-too-long
"""Gets the available PrivateEndpointConnections within a namespace.
.. seealso::
@@ -92,7 +94,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,
@@ -249,7 +251,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -300,14 +302,7 @@ async def create_or_update(
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("PrivateEndpointConnection", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -317,7 +312,7 @@ async def create_or_update(
async def _delete_initial(
self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -344,6 +339,7 @@ async def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -352,19 +348,15 @@ async def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -453,7 +445,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_private_link_resources_operations.py
index 11c41181e08bc..b0a6a1f9fcc43 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_private_link_resources_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_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,
@@ -29,7 +28,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]]
@@ -71,7 +70,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.PrivateLinkResourcesListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_schema_registry_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_schema_registry_operations.py
index 8de04b1010dcc..7a07265d7d8ae 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_schema_registry_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/aio/operations/_schema_registry_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -38,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]]
@@ -98,7 +97,7 @@ def list_by_namespace(
)
cls: ClsType[_models.SchemaGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -245,7 +244,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.SchemaGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -304,7 +303,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, namespace_name: str, schema_group_name: str, **kwargs: Any
) -> None:
"""Deletes an EventHub schema group.
@@ -319,7 +318,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,
@@ -377,7 +376,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.SchemaGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/models/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/models/__init__.py
index 552ebc31f3f48..51b3f6f43508b 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/models/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/models/__init__.py
@@ -5,105 +5,116 @@
# 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 AccessKeys
-from ._models_py3 import ApplicationGroup
-from ._models_py3 import ApplicationGroupListResult
-from ._models_py3 import ApplicationGroupPolicy
-from ._models_py3 import ArmDisasterRecovery
-from ._models_py3 import ArmDisasterRecoveryListResult
-from ._models_py3 import AuthorizationRule
-from ._models_py3 import AuthorizationRuleListResult
-from ._models_py3 import AvailableCluster
-from ._models_py3 import AvailableClustersList
-from ._models_py3 import CaptureDescription
-from ._models_py3 import CheckNameAvailabilityParameter
-from ._models_py3 import CheckNameAvailabilityResult
-from ._models_py3 import Cluster
-from ._models_py3 import ClusterListResult
-from ._models_py3 import ClusterQuotaConfigurationProperties
-from ._models_py3 import ClusterSku
-from ._models_py3 import ConnectionState
-from ._models_py3 import ConsumerGroup
-from ._models_py3 import ConsumerGroupListResult
-from ._models_py3 import Destination
-from ._models_py3 import EHNamespace
-from ._models_py3 import EHNamespaceIdContainer
-from ._models_py3 import EHNamespaceIdListResult
-from ._models_py3 import EHNamespaceListResult
-from ._models_py3 import Encryption
-from ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
-from ._models_py3 import EventHubListResult
-from ._models_py3 import Eventhub
-from ._models_py3 import Identity
-from ._models_py3 import KeyVaultProperties
-from ._models_py3 import NWRuleSetIpRules
-from ._models_py3 import NWRuleSetVirtualNetworkRules
-from ._models_py3 import NetworkRuleSet
-from ._models_py3 import NetworkRuleSetListResult
-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 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 PrivateLinkResourcesListResult
-from ._models_py3 import ProvisioningIssue
-from ._models_py3 import ProvisioningIssueProperties
-from ._models_py3 import ProxyResource
-from ._models_py3 import RegenerateAccessKeyParameters
-from ._models_py3 import Resource
-from ._models_py3 import RetentionDescription
-from ._models_py3 import SchemaGroup
-from ._models_py3 import SchemaGroupListResult
-from ._models_py3 import Sku
-from ._models_py3 import Subnet
-from ._models_py3 import SystemData
-from ._models_py3 import ThrottlingPolicy
-from ._models_py3 import TrackedResource
-from ._models_py3 import UserAssignedIdentity
-from ._models_py3 import UserAssignedIdentityProperties
+from typing import TYPE_CHECKING
-from ._event_hub_management_client_enums import AccessRights
-from ._event_hub_management_client_enums import ApplicationGroupPolicyType
-from ._event_hub_management_client_enums import CleanupPolicyRetentionDescription
-from ._event_hub_management_client_enums import ClusterSkuName
-from ._event_hub_management_client_enums import CreatedByType
-from ._event_hub_management_client_enums import DefaultAction
-from ._event_hub_management_client_enums import EncodingCaptureDescription
-from ._event_hub_management_client_enums import EndPointProvisioningState
-from ._event_hub_management_client_enums import EntityStatus
-from ._event_hub_management_client_enums import KeyType
-from ._event_hub_management_client_enums import ManagedServiceIdentityType
-from ._event_hub_management_client_enums import MetricId
-from ._event_hub_management_client_enums import NetworkRuleIPAction
-from ._event_hub_management_client_enums import NetworkSecurityPerimeterConfigurationProvisioningState
-from ._event_hub_management_client_enums import NspAccessRuleDirection
-from ._event_hub_management_client_enums import PrivateLinkConnectionStatus
-from ._event_hub_management_client_enums import ProvisioningStateDR
-from ._event_hub_management_client_enums import PublicNetworkAccess
-from ._event_hub_management_client_enums import PublicNetworkAccessFlag
-from ._event_hub_management_client_enums import ResourceAssociationAccessMode
-from ._event_hub_management_client_enums import RoleDisasterRecovery
-from ._event_hub_management_client_enums import SchemaCompatibility
-from ._event_hub_management_client_enums import SchemaType
-from ._event_hub_management_client_enums import SkuName
-from ._event_hub_management_client_enums import SkuTier
-from ._event_hub_management_client_enums import TlsVersion
-from ._event_hub_management_client_enums import UnavailableReason
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ AccessKeys,
+ ApplicationGroup,
+ ApplicationGroupListResult,
+ ApplicationGroupPolicy,
+ ArmDisasterRecovery,
+ ArmDisasterRecoveryListResult,
+ AuthorizationRule,
+ AuthorizationRuleListResult,
+ AvailableCluster,
+ AvailableClustersList,
+ CaptureDescription,
+ CheckNameAvailabilityParameter,
+ CheckNameAvailabilityResult,
+ Cluster,
+ ClusterListResult,
+ ClusterQuotaConfigurationProperties,
+ ClusterSku,
+ ConnectionState,
+ ConsumerGroup,
+ ConsumerGroupListResult,
+ Destination,
+ EHNamespace,
+ EHNamespaceIdContainer,
+ EHNamespaceIdListResult,
+ EHNamespaceListResult,
+ Encryption,
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ EventHubListResult,
+ Eventhub,
+ Identity,
+ KeyVaultProperties,
+ NWRuleSetIpRules,
+ NWRuleSetVirtualNetworkRules,
+ NetworkRuleSet,
+ NetworkRuleSetListResult,
+ NetworkSecurityPerimeter,
+ NetworkSecurityPerimeterConfiguration,
+ NetworkSecurityPerimeterConfigurationList,
+ NetworkSecurityPerimeterConfigurationPropertiesProfile,
+ NetworkSecurityPerimeterConfigurationPropertiesResourceAssociation,
+ NspAccessRule,
+ NspAccessRuleProperties,
+ NspAccessRulePropertiesSubscriptionsItem,
+ Operation,
+ OperationDisplay,
+ OperationListResult,
+ PrivateEndpoint,
+ PrivateEndpointConnection,
+ PrivateEndpointConnectionListResult,
+ PrivateLinkResource,
+ PrivateLinkResourcesListResult,
+ ProvisioningIssue,
+ ProvisioningIssueProperties,
+ ProxyResource,
+ RegenerateAccessKeyParameters,
+ Resource,
+ RetentionDescription,
+ SchemaGroup,
+ SchemaGroupListResult,
+ Sku,
+ Subnet,
+ SystemData,
+ ThrottlingPolicy,
+ TrackedResource,
+ UserAssignedIdentity,
+ UserAssignedIdentityProperties,
+)
+
+from ._event_hub_management_client_enums import ( # type: ignore
+ AccessRights,
+ ApplicationGroupPolicyType,
+ CleanupPolicyRetentionDescription,
+ ClusterSkuName,
+ CreatedByType,
+ DefaultAction,
+ EncodingCaptureDescription,
+ EndPointProvisioningState,
+ EntityStatus,
+ KeyType,
+ ManagedServiceIdentityType,
+ MetricId,
+ NetworkRuleIPAction,
+ NetworkSecurityPerimeterConfigurationProvisioningState,
+ NspAccessRuleDirection,
+ PrivateLinkConnectionStatus,
+ ProvisioningStateDR,
+ PublicNetworkAccess,
+ PublicNetworkAccessFlag,
+ ResourceAssociationAccessMode,
+ RoleDisasterRecovery,
+ SchemaCompatibility,
+ SchemaType,
+ SkuName,
+ SkuTier,
+ TlsVersion,
+ UnavailableReason,
+)
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__ = [
@@ -203,5 +214,5 @@
"TlsVersion",
"UnavailableReason",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/models/_models_py3.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/models/_models_py3.py
index fefc395688080..1098f33efd7b0 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/models/_models_py3.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_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
@@ -724,7 +723,7 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s
self.tags = tags
-class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes
+class Cluster(TrackedResource):
"""Single Event Hubs Cluster resource in List or Get operations.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1101,7 +1100,7 @@ def __init__(
self.data_lake_folder_path = data_lake_folder_path
-class EHNamespace(TrackedResource): # pylint: disable=too-many-instance-attributes
+class EHNamespace(TrackedResource):
"""Single Namespace item in List or Get Operation.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1503,7 +1502,7 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A
self.error = error
-class Eventhub(ProxyResource): # pylint: disable=too-many-instance-attributes
+class Eventhub(ProxyResource):
"""Single item in List or Get Event Hub operation.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -2788,7 +2787,7 @@ def __init__(
self.tombstone_retention_time_in_hours = tombstone_retention_time_in_hours
-class SchemaGroup(ProxyResource): # pylint: disable=too-many-instance-attributes
+class SchemaGroup(ProxyResource):
"""Single item in List or Get Schema Group operation.
Variables are only populated by the server, and will be ignored when sending a request.
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/__init__.py
index df31dad29631d..e13b4bfcc1d61 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/__init__.py
@@ -5,23 +5,29 @@
# 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 ._clusters_operations import ClustersOperations
-from ._namespaces_operations import NamespacesOperations
-from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
-from ._private_link_resources_operations import PrivateLinkResourcesOperations
-from ._network_security_perimeter_configuration_operations import NetworkSecurityPerimeterConfigurationOperations
-from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations
-from ._configuration_operations import ConfigurationOperations
-from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations
-from ._event_hubs_operations import EventHubsOperations
-from ._consumer_groups_operations import ConsumerGroupsOperations
-from ._operations import Operations
-from ._schema_registry_operations import SchemaRegistryOperations
-from ._application_group_operations import ApplicationGroupOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._clusters_operations import ClustersOperations # type: ignore
+from ._namespaces_operations import NamespacesOperations # type: ignore
+from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore
+from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore
+from ._network_security_perimeter_configuration_operations import NetworkSecurityPerimeterConfigurationOperations # type: ignore
+from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore
+from ._configuration_operations import ConfigurationOperations # type: ignore
+from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations # type: ignore
+from ._event_hubs_operations import EventHubsOperations # type: ignore
+from ._consumer_groups_operations import ConsumerGroupsOperations # type: ignore
+from ._operations import Operations # type: ignore
+from ._schema_registry_operations import SchemaRegistryOperations # type: ignore
+from ._application_group_operations import ApplicationGroupOperations # 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__ = [
@@ -39,5 +45,5 @@
"SchemaRegistryOperations",
"ApplicationGroupOperations",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_application_group_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_application_group_operations.py
index fd3318176c88c..c8b45dec1a9c6 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_application_group_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_application_group_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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 (
@@ -32,7 +31,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -255,7 +254,7 @@ def list_by_namespace(
)
cls: ClsType[_models.ApplicationGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -400,7 +399,7 @@ def create_or_update_application_group(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.ApplicationGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -474,7 +473,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,
@@ -532,7 +531,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.ApplicationGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_clusters_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_clusters_operations.py
index 6f5aaee058b16..957efd71c2ba2 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_clusters_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_clusters_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, Iterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -321,7 +323,7 @@ def list_available_cluster_region(self, **kwargs: Any) -> _models.AvailableClust
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AvailableClustersList
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -380,7 +382,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Cluster"]:
)
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -459,7 +461,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite
)
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -533,7 +535,7 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.Cluster
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -581,7 +583,7 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo
def _create_or_update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -619,6 +621,7 @@ def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -627,19 +630,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -767,7 +766,7 @@ def get_long_running_output(pipeline_response):
def _update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -805,6 +804,7 @@ def _update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -813,19 +813,15 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -951,7 +947,7 @@ def get_long_running_output(pipeline_response):
)
def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -977,6 +973,7 @@ def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs:
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -985,19 +982,15 @@ def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs:
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1072,7 +1065,7 @@ def list_namespaces(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.EHNamespaceIdListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_configuration_operations.py
index 024c126596780..e877a1e401947 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_configuration_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_configuration_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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,
@@ -30,7 +29,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -207,7 +206,7 @@ def patch(
None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -258,11 +257,7 @@ def patch(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
+ deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -284,7 +279,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.ClusterQuotaConfigurationProperties
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_consumer_groups_operations.py
index a032f7d57304e..2e80a4ad01b3c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_consumer_groups_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_consumer_groups_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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 (
@@ -32,7 +31,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -353,7 +352,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -435,7 +434,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,
@@ -501,7 +500,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -587,7 +586,7 @@ def list_by_event_hub(
)
cls: ClsType[_models.ConsumerGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_disaster_recovery_configs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_disaster_recovery_configs_operations.py
index 2921af748d396..b39aa123f8e1a 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_disaster_recovery_configs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_disaster_recovery_configs_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 (
@@ -32,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -515,7 +515,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -597,7 +597,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -662,7 +662,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -784,7 +784,7 @@ def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -864,7 +864,7 @@ def list(
)
cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1012,7 +1012,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1063,11 +1063,7 @@ def create_or_update(
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("ArmDisasterRecovery", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response.http_response)
+ deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1090,7 +1086,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,
@@ -1148,7 +1144,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1211,7 +1207,7 @@ def break_pairing( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1269,7 +1265,7 @@ def fail_over( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_event_hubs_operations.py
index 8f2a06401bf61..8951e78110d38 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_event_hubs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_event_hubs_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 (
@@ -32,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -553,7 +553,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -712,7 +712,7 @@ def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -794,7 +794,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -864,7 +864,7 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -930,7 +930,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1072,7 +1072,7 @@ def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1165,7 +1165,7 @@ def list_by_namespace(
)
cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1312,7 +1312,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1386,7 +1386,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,
@@ -1444,7 +1444,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_namespaces_operations.py
index d3997d6c26e77..da5e9bde2cb65 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_namespaces_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_namespaces_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, Iterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -712,7 +714,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.EHNamespace"]:
)
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -792,7 +794,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite
)
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -861,7 +863,7 @@ def _create_or_update_initial(
parameters: Union[_models.EHNamespace, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -899,6 +901,7 @@ def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -907,19 +910,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1058,7 +1057,7 @@ def get_long_running_output(pipeline_response):
)
def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1084,6 +1083,7 @@ def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwarg
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -1092,19 +1092,15 @@ def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwarg
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1178,7 +1174,7 @@ def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.EHNamespace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1299,7 +1295,7 @@ def update(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.EHNamespace or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1350,11 +1346,7 @@ def update(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
+ deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1434,7 +1426,7 @@ def create_or_update_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1505,7 +1497,7 @@ def get_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1564,7 +1556,7 @@ def list_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.NetworkRuleSetListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1632,7 +1624,7 @@ def list_authorization_rules(
)
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1778,7 +1770,7 @@ def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1852,7 +1844,7 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1910,7 +1902,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1972,7 +1964,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2101,7 +2093,7 @@ def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2210,7 +2202,7 @@ def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_network_security_perimeter_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_network_security_perimeter_configuration_operations.py
index 8a091fd4d12e5..5ce0a2c41978d 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_network_security_perimeter_configuration_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_network_security_perimeter_configuration_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,
@@ -29,7 +28,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -112,7 +111,7 @@ def list(
~azure.mgmt.eventhub.v2022_10_01_preview.models.NetworkSecurityPerimeterConfigurationList
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_network_security_perimeter_configurations_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_network_security_perimeter_configurations_operations.py
index 1fe4538da9b1c..6c8a4f2a0edee 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_network_security_perimeter_configurations_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/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, Iterator, Optional, Type, TypeVar, Union, cast
+from typing import Any, Callable, Dict, Iterator, Optional, TypeVar, Union, cast
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -15,6 +14,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -31,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -103,7 +104,7 @@ def __init__(self, *args, **kwargs):
def _create_or_update_initial(
self, resource_group_name: str, namespace_name: str, resource_association_name: str, **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -130,6 +131,7 @@ def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -138,16 +140,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_operations.py
index c8b2dac9766ba..cec27e2bd2d80 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_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 (
@@ -31,7 +30,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -94,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,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_private_endpoint_connections_operations.py
index be58dc12d9ef8..bb5d45826269e 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_private_endpoint_connections_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_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, Iterator, 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,6 +16,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,7 +35,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -273,7 +274,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,
@@ -430,7 +431,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -481,14 +482,7 @@ def create_or_update(
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("PrivateEndpointConnection", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -498,7 +492,7 @@ def create_or_update(
def _delete_initial(
self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -525,6 +519,7 @@ def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -533,19 +528,15 @@ def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -634,7 +625,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_private_link_resources_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_private_link_resources_operations.py
index 47fa617220e75..f4a022baaeaca 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_private_link_resources_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_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,
@@ -29,7 +28,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -114,7 +113,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.PrivateLinkResourcesListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_schema_registry_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_schema_registry_operations.py
index 755dbe0a9631f..2b52a79791b81 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_schema_registry_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2022_10_01_preview/operations/_schema_registry_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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 (
@@ -32,7 +31,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -271,7 +270,7 @@ def list_by_namespace(
)
cls: ClsType[_models.SchemaGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -418,7 +417,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.SchemaGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -492,7 +491,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,
@@ -550,7 +549,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2022_10_01_preview.models.SchemaGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/__init__.py
index 7fb5add1ee3c8..2c8cfb26ae171 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_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 ._event_hub_management_client import EventHubManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._event_hub_management_client import EventHubManagementClient # 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__ = [
"EventHubManagementClient",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/_configuration.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/_configuration.py
index 767576160eae1..d2c3b9e19bcd5 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/_configuration.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_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 EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+class EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for EventHubManagementClient.
Note that all parameters used to create this instance are saved as instance
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/_event_hub_management_client.py
index dbf1aaa5fcdc8..b7cbd976baf2c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/_event_hub_management_client.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/_event_hub_management_client.py
@@ -35,11 +35,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class EventHubManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class EventHubManagementClient: # pylint: disable=too-many-instance-attributes
"""Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules
resources.
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/_version.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/_version.py
index 3767c560d3516..e5754a47ce68f 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/_version.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "11.1.0"
+VERSION = "1.0.0b1"
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/__init__.py
index 699f917e93165..3cca02660c65c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_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 ._event_hub_management_client import EventHubManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._event_hub_management_client import EventHubManagementClient # 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__ = [
"EventHubManagementClient",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/_configuration.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/_configuration.py
index 663e2de72e17a..0921e011ab14b 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/_configuration.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_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 EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+class EventHubManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for EventHubManagementClient.
Note that all parameters used to create this instance are saved as instance
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/_event_hub_management_client.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/_event_hub_management_client.py
index 4bd86f472d555..859c5e25547e6 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/_event_hub_management_client.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/_event_hub_management_client.py
@@ -35,11 +35,10 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class EventHubManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
+class EventHubManagementClient: # pylint: disable=too-many-instance-attributes
"""Azure Event Hubs client for managing Event Hubs Cluster, IPFilter Rules and VirtualNetworkRules
resources.
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/__init__.py
index df31dad29631d..e13b4bfcc1d61 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/__init__.py
@@ -5,23 +5,29 @@
# 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 ._clusters_operations import ClustersOperations
-from ._namespaces_operations import NamespacesOperations
-from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
-from ._private_link_resources_operations import PrivateLinkResourcesOperations
-from ._network_security_perimeter_configuration_operations import NetworkSecurityPerimeterConfigurationOperations
-from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations
-from ._configuration_operations import ConfigurationOperations
-from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations
-from ._event_hubs_operations import EventHubsOperations
-from ._consumer_groups_operations import ConsumerGroupsOperations
-from ._operations import Operations
-from ._schema_registry_operations import SchemaRegistryOperations
-from ._application_group_operations import ApplicationGroupOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._clusters_operations import ClustersOperations # type: ignore
+from ._namespaces_operations import NamespacesOperations # type: ignore
+from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore
+from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore
+from ._network_security_perimeter_configuration_operations import NetworkSecurityPerimeterConfigurationOperations # type: ignore
+from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore
+from ._configuration_operations import ConfigurationOperations # type: ignore
+from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations # type: ignore
+from ._event_hubs_operations import EventHubsOperations # type: ignore
+from ._consumer_groups_operations import ConsumerGroupsOperations # type: ignore
+from ._operations import Operations # type: ignore
+from ._schema_registry_operations import SchemaRegistryOperations # type: ignore
+from ._application_group_operations import ApplicationGroupOperations # 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__ = [
@@ -39,5 +45,5 @@
"SchemaRegistryOperations",
"ApplicationGroupOperations",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_application_group_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_application_group_operations.py
index 6b68f625ae805..415d30c80a63c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_application_group_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_application_group_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -38,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]]
@@ -84,7 +83,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.ApplicationGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -229,7 +228,7 @@ async def create_or_update_application_group(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.ApplicationGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -286,7 +285,7 @@ async def create_or_update_application_group(
return deserialized # type: ignore
@distributed_trace_async
- async def delete( # pylint: disable=inconsistent-return-statements
+ async def delete(
self, resource_group_name: str, namespace_name: str, application_group_name: str, **kwargs: Any
) -> None:
"""Deletes an ApplicationGroup for a Namespace.
@@ -301,7 +300,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,
@@ -357,7 +356,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.ApplicationGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_clusters_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_clusters_operations.py
index a1f3702cbf65a..771845a023ef1 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_clusters_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_clusters_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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, AsyncIterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -44,7 +45,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]]
@@ -77,7 +78,7 @@ async def list_available_cluster_region(self, **kwargs: Any) -> _models.Availabl
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AvailableClustersList
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -133,7 +134,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Cluster"
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -211,7 +212,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -285,7 +286,7 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any)
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.Cluster
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -331,7 +332,7 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any)
async def _create_or_update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -367,6 +368,7 @@ async def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -375,19 +377,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -516,7 +514,7 @@ def get_long_running_output(pipeline_response):
async def _update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -552,6 +550,7 @@ async def _update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -560,19 +559,15 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -699,7 +694,7 @@ def get_long_running_output(pipeline_response):
)
async def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -723,6 +718,7 @@ async def _delete_initial(self, resource_group_name: str, cluster_name: str, **k
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -731,19 +727,15 @@ async def _delete_initial(self, resource_group_name: str, cluster_name: str, **k
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -816,7 +808,7 @@ async def list_namespaces(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.EHNamespaceIdListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_configuration_operations.py
index 4aa88100d5010..a1fb51c4eec6b 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_configuration_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_configuration_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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,
@@ -30,7 +29,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 +131,7 @@ async def patch(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.ClusterQuotaConfigurationProperties or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -181,11 +180,7 @@ async def patch(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
+ deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -207,7 +202,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.ClusterQuotaConfigurationProperties
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_consumer_groups_operations.py
index 0ef9f1628c92a..c630b4885a3a6 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_consumer_groups_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_consumer_groups_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -38,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]]
@@ -154,7 +153,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -212,7 +211,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,
namespace_name: str,
@@ -234,7 +233,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,
@@ -298,7 +297,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -380,7 +379,7 @@ def list_by_event_hub(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.ConsumerGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_disaster_recovery_configs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_disaster_recovery_configs_operations.py
index 359483031888b..1b5924cbefe13 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_disaster_recovery_configs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_disaster_recovery_configs_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -44,7 +43,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 +91,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -174,7 +173,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -237,7 +236,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -356,7 +355,7 @@ async def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -432,7 +431,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -579,7 +578,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -628,11 +627,7 @@ async def create_or_update(
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("ArmDisasterRecovery", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response.http_response)
+ deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -640,9 +635,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, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def delete(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""Deletes an Alias(Disaster Recovery configuration).
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -655,7 +648,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,
@@ -711,7 +704,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -756,9 +749,7 @@ async def get(
return deserialized # type: ignore
@distributed_trace_async
- async def break_pairing( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def break_pairing(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""This operation disables the Disaster Recovery and stops replicating changes from primary to
secondary namespaces.
@@ -772,7 +763,7 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -813,9 +804,7 @@ async def break_pairing( # pylint: disable=inconsistent-return-statements
return cls(pipeline_response, None, {}) # type: ignore
@distributed_trace_async
- async def fail_over( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any
- ) -> None:
+ async def fail_over(self, resource_group_name: str, namespace_name: str, alias: str, **kwargs: Any) -> None:
"""Invokes GEO DR failover and reconfigure the alias to point to the secondary namespace.
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -828,7 +817,7 @@ async def fail_over( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_event_hubs_operations.py
index 53822e305a1a5..e98d8d6e6966e 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_event_hubs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_event_hubs_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
@@ -44,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]]
@@ -92,7 +92,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -250,7 +250,7 @@ async def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -330,7 +330,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -376,7 +376,7 @@ async def get_authorization_rule(
return deserialized # type: ignore
@distributed_trace_async
- async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
+ async def delete_authorization_rule(
self,
resource_group_name: str,
namespace_name: str,
@@ -398,7 +398,7 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -462,7 +462,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -602,7 +602,7 @@ async def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -692,7 +692,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -839,7 +839,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -896,9 +896,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, namespace_name: str, event_hub_name: str, **kwargs: Any
- ) -> None:
+ async def delete(self, resource_group_name: str, namespace_name: str, event_hub_name: str, **kwargs: Any) -> None:
"""Deletes an Event Hub from the specified Namespace and resource group.
:param resource_group_name: Name of the resource group within the azure subscription. Required.
@@ -911,7 +909,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,
@@ -967,7 +965,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_namespaces_operations.py
index b884855a171ae..9ec6fa3bb1bd5 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_namespaces_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_namespaces_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, AsyncIterator, 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,6 +18,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -52,7 +54,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 +94,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.EHNamespace"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -170,7 +172,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -239,7 +241,7 @@ async def _create_or_update_initial(
parameters: Union[_models.EHNamespace, IO[bytes]],
**kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -275,6 +277,7 @@ async def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -283,19 +286,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -431,7 +430,7 @@ def get_long_running_output(pipeline_response):
async def _delete_initial(
self, resource_group_name: str, namespace_name: str, **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -455,6 +454,7 @@ async def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -463,19 +463,15 @@ async def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -547,7 +543,7 @@ async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.EHNamespace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -666,7 +662,7 @@ async def update(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.EHNamespace or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -715,11 +711,7 @@ async def update(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
+ deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -799,7 +791,7 @@ async def create_or_update_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -868,7 +860,7 @@ async def get_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -925,7 +917,7 @@ async def list_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.NetworkRuleSetListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -989,7 +981,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1134,7 +1126,7 @@ async def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1191,7 +1183,7 @@ async def create_or_update_authorization_rule(
return deserialized # type: ignore
@distributed_trace_async
- async def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
+ async def delete_authorization_rule(
self, resource_group_name: str, namespace_name: str, authorization_rule_name: str, **kwargs: Any
) -> None:
"""Deletes an AuthorizationRule for a Namespace.
@@ -1206,7 +1198,7 @@ async def delete_authorization_rule( # pylint: disable=inconsistent-return-stat
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1262,7 +1254,7 @@ async def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1322,7 +1314,7 @@ async def list_keys(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1449,7 +1441,7 @@ async def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1555,7 +1547,7 @@ async def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_network_security_perimeter_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_network_security_perimeter_configuration_operations.py
index 5ae371c197081..af21912a074e6 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_network_security_perimeter_configuration_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_network_security_perimeter_configuration_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,
@@ -29,7 +28,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]]
@@ -68,7 +67,7 @@ async def list(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.NetworkSecurityPerimeterConfigurationList
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_network_security_perimeter_configurations_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_network_security_perimeter_configurations_operations.py
index 114c6d2aab76a..ef71cd249b288 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_network_security_perimeter_configurations_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_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, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast
+from typing import Any, AsyncIterator, Callable, Dict, Optional, TypeVar, Union, cast
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -15,6 +14,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -31,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]]
@@ -59,7 +60,7 @@ def __init__(self, *args, **kwargs) -> None:
async def _create_or_update_initial(
self, resource_group_name: str, namespace_name: str, resource_association_name: str, **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -84,6 +85,7 @@ async def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -92,16 +94,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_operations.py
index 995ff2eecd565..c9cb8b63db240 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_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
@@ -31,7 +30,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]]
@@ -71,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 "2024-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,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_private_endpoint_connections_operations.py
index a02ad6e3e91f8..3de2ecff6d07e 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_private_endpoint_connections_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_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, AsyncIterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -40,7 +41,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 +91,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-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,
@@ -247,7 +248,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -296,14 +297,7 @@ async def create_or_update(
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("PrivateEndpointConnection", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -313,7 +307,7 @@ async def create_or_update(
async def _delete_initial(
self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> AsyncIterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -338,6 +332,7 @@ async def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -346,19 +341,15 @@ async def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- await response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -445,7 +436,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_private_link_resources_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_private_link_resources_operations.py
index c69ba93a33876..f94f92f6bad16 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_private_link_resources_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_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,
@@ -29,7 +28,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]]
@@ -71,7 +70,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.PrivateLinkResourcesListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_schema_registry_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_schema_registry_operations.py
index 6c204abd4f837..9593c0c487a08 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_schema_registry_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/aio/operations/_schema_registry_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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
@@ -38,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]]
@@ -96,7 +95,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.SchemaGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -243,7 +242,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.SchemaGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -300,7 +299,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, namespace_name: str, schema_group_name: str, **kwargs: Any
) -> None:
"""Deletes an EventHub schema group.
@@ -315,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,
@@ -371,7 +370,7 @@ async def get(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.SchemaGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/models/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/models/__init__.py
index 2b8c46c9d013b..c06b9da205f5d 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/models/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/models/__init__.py
@@ -5,108 +5,119 @@
# 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 AccessKeys
-from ._models_py3 import ApplicationGroup
-from ._models_py3 import ApplicationGroupListResult
-from ._models_py3 import ApplicationGroupPolicy
-from ._models_py3 import ArmDisasterRecovery
-from ._models_py3 import ArmDisasterRecoveryListResult
-from ._models_py3 import AuthorizationRule
-from ._models_py3 import AuthorizationRuleListResult
-from ._models_py3 import AvailableCluster
-from ._models_py3 import AvailableClustersList
-from ._models_py3 import CaptureDescription
-from ._models_py3 import CaptureIdentity
-from ._models_py3 import CheckNameAvailabilityParameter
-from ._models_py3 import CheckNameAvailabilityResult
-from ._models_py3 import Cluster
-from ._models_py3 import ClusterListResult
-from ._models_py3 import ClusterQuotaConfigurationProperties
-from ._models_py3 import ClusterSku
-from ._models_py3 import ConnectionState
-from ._models_py3 import ConsumerGroup
-from ._models_py3 import ConsumerGroupListResult
-from ._models_py3 import Destination
-from ._models_py3 import EHNamespace
-from ._models_py3 import EHNamespaceIdContainer
-from ._models_py3 import EHNamespaceIdListResult
-from ._models_py3 import EHNamespaceListResult
-from ._models_py3 import Encryption
-from ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
-from ._models_py3 import EventHubListResult
-from ._models_py3 import Eventhub
-from ._models_py3 import Identity
-from ._models_py3 import KeyVaultProperties
-from ._models_py3 import NWRuleSetIpRules
-from ._models_py3 import NWRuleSetVirtualNetworkRules
-from ._models_py3 import NetworkRuleSet
-from ._models_py3 import NetworkRuleSetListResult
-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 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 PrivateLinkResourcesListResult
-from ._models_py3 import ProvisioningIssue
-from ._models_py3 import ProvisioningIssueProperties
-from ._models_py3 import ProxyResource
-from ._models_py3 import RegenerateAccessKeyParameters
-from ._models_py3 import Resource
-from ._models_py3 import RetentionDescription
-from ._models_py3 import SchemaGroup
-from ._models_py3 import SchemaGroupListResult
-from ._models_py3 import Sku
-from ._models_py3 import Subnet
-from ._models_py3 import SystemData
-from ._models_py3 import ThrottlingPolicy
-from ._models_py3 import TrackedResource
-from ._models_py3 import UserAssignedIdentity
-from ._models_py3 import UserAssignedIdentityProperties
+from typing import TYPE_CHECKING
-from ._event_hub_management_client_enums import AccessRights
-from ._event_hub_management_client_enums import ApplicationGroupPolicyType
-from ._event_hub_management_client_enums import CaptureIdentityType
-from ._event_hub_management_client_enums import CleanupPolicyRetentionDescription
-from ._event_hub_management_client_enums import ClusterSkuName
-from ._event_hub_management_client_enums import CreatedByType
-from ._event_hub_management_client_enums import DefaultAction
-from ._event_hub_management_client_enums import EncodingCaptureDescription
-from ._event_hub_management_client_enums import EndPointProvisioningState
-from ._event_hub_management_client_enums import EntityStatus
-from ._event_hub_management_client_enums import KeyType
-from ._event_hub_management_client_enums import ManagedServiceIdentityType
-from ._event_hub_management_client_enums import MetricId
-from ._event_hub_management_client_enums import NetworkRuleIPAction
-from ._event_hub_management_client_enums import NetworkSecurityPerimeterConfigurationProvisioningState
-from ._event_hub_management_client_enums import NspAccessRuleDirection
-from ._event_hub_management_client_enums import PrivateLinkConnectionStatus
-from ._event_hub_management_client_enums import ProvisioningState
-from ._event_hub_management_client_enums import ProvisioningStateDR
-from ._event_hub_management_client_enums import PublicNetworkAccess
-from ._event_hub_management_client_enums import PublicNetworkAccessFlag
-from ._event_hub_management_client_enums import ResourceAssociationAccessMode
-from ._event_hub_management_client_enums import RoleDisasterRecovery
-from ._event_hub_management_client_enums import SchemaCompatibility
-from ._event_hub_management_client_enums import SchemaType
-from ._event_hub_management_client_enums import SkuName
-from ._event_hub_management_client_enums import SkuTier
-from ._event_hub_management_client_enums import TlsVersion
-from ._event_hub_management_client_enums import UnavailableReason
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ AccessKeys,
+ ApplicationGroup,
+ ApplicationGroupListResult,
+ ApplicationGroupPolicy,
+ ArmDisasterRecovery,
+ ArmDisasterRecoveryListResult,
+ AuthorizationRule,
+ AuthorizationRuleListResult,
+ AvailableCluster,
+ AvailableClustersList,
+ CaptureDescription,
+ CaptureIdentity,
+ CheckNameAvailabilityParameter,
+ CheckNameAvailabilityResult,
+ Cluster,
+ ClusterListResult,
+ ClusterQuotaConfigurationProperties,
+ ClusterSku,
+ ConnectionState,
+ ConsumerGroup,
+ ConsumerGroupListResult,
+ Destination,
+ EHNamespace,
+ EHNamespaceIdContainer,
+ EHNamespaceIdListResult,
+ EHNamespaceListResult,
+ Encryption,
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ EventHubListResult,
+ Eventhub,
+ Identity,
+ KeyVaultProperties,
+ NWRuleSetIpRules,
+ NWRuleSetVirtualNetworkRules,
+ NetworkRuleSet,
+ NetworkRuleSetListResult,
+ NetworkSecurityPerimeter,
+ NetworkSecurityPerimeterConfiguration,
+ NetworkSecurityPerimeterConfigurationList,
+ NetworkSecurityPerimeterConfigurationPropertiesProfile,
+ NetworkSecurityPerimeterConfigurationPropertiesResourceAssociation,
+ NspAccessRule,
+ NspAccessRuleProperties,
+ NspAccessRulePropertiesSubscriptionsItem,
+ Operation,
+ OperationDisplay,
+ OperationListResult,
+ PrivateEndpoint,
+ PrivateEndpointConnection,
+ PrivateEndpointConnectionListResult,
+ PrivateLinkResource,
+ PrivateLinkResourcesListResult,
+ ProvisioningIssue,
+ ProvisioningIssueProperties,
+ ProxyResource,
+ RegenerateAccessKeyParameters,
+ Resource,
+ RetentionDescription,
+ SchemaGroup,
+ SchemaGroupListResult,
+ Sku,
+ Subnet,
+ SystemData,
+ ThrottlingPolicy,
+ TrackedResource,
+ UserAssignedIdentity,
+ UserAssignedIdentityProperties,
+)
+
+from ._event_hub_management_client_enums import ( # type: ignore
+ AccessRights,
+ ApplicationGroupPolicyType,
+ CaptureIdentityType,
+ CleanupPolicyRetentionDescription,
+ ClusterSkuName,
+ CreatedByType,
+ DefaultAction,
+ EncodingCaptureDescription,
+ EndPointProvisioningState,
+ EntityStatus,
+ KeyType,
+ ManagedServiceIdentityType,
+ MetricId,
+ NetworkRuleIPAction,
+ NetworkSecurityPerimeterConfigurationProvisioningState,
+ NspAccessRuleDirection,
+ PrivateLinkConnectionStatus,
+ ProvisioningState,
+ ProvisioningStateDR,
+ PublicNetworkAccess,
+ PublicNetworkAccessFlag,
+ ResourceAssociationAccessMode,
+ RoleDisasterRecovery,
+ SchemaCompatibility,
+ SchemaType,
+ SkuName,
+ SkuTier,
+ TlsVersion,
+ UnavailableReason,
+)
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__ = [
@@ -209,5 +220,5 @@
"TlsVersion",
"UnavailableReason",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/models/_models_py3.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/models/_models_py3.py
index a38556cfe7495..118ec38c8b9cd 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/models/_models_py3.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_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.
@@ -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
@@ -757,7 +756,7 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s
self.tags = tags
-class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes
+class Cluster(TrackedResource):
"""Single Event Hubs Cluster resource in List or Get operations.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1145,7 +1144,7 @@ def __init__(
self.data_lake_folder_path = data_lake_folder_path
-class EHNamespace(TrackedResource): # pylint: disable=too-many-instance-attributes
+class EHNamespace(TrackedResource):
"""Single Namespace item in List or Get Operation.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1545,7 +1544,7 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A
self.error = error
-class Eventhub(ProxyResource): # pylint: disable=too-many-instance-attributes
+class Eventhub(ProxyResource):
"""Single item in List or Get Event Hub operation.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1949,7 +1948,7 @@ def __init__(
self.location = location
-class NetworkSecurityPerimeterConfiguration(ProxyResource): # pylint: disable=too-many-instance-attributes
+class NetworkSecurityPerimeterConfiguration(ProxyResource):
"""Network Security Perimeter related configurations of a given namespace.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -2845,7 +2844,7 @@ def __init__(
self.tombstone_retention_time_in_hours = tombstone_retention_time_in_hours
-class SchemaGroup(ProxyResource): # pylint: disable=too-many-instance-attributes
+class SchemaGroup(ProxyResource):
"""Single item in List or Get Schema Group operation.
Variables are only populated by the server, and will be ignored when sending a request.
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/__init__.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/__init__.py
index df31dad29631d..e13b4bfcc1d61 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/__init__.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/__init__.py
@@ -5,23 +5,29 @@
# 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 ._clusters_operations import ClustersOperations
-from ._namespaces_operations import NamespacesOperations
-from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
-from ._private_link_resources_operations import PrivateLinkResourcesOperations
-from ._network_security_perimeter_configuration_operations import NetworkSecurityPerimeterConfigurationOperations
-from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations
-from ._configuration_operations import ConfigurationOperations
-from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations
-from ._event_hubs_operations import EventHubsOperations
-from ._consumer_groups_operations import ConsumerGroupsOperations
-from ._operations import Operations
-from ._schema_registry_operations import SchemaRegistryOperations
-from ._application_group_operations import ApplicationGroupOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._clusters_operations import ClustersOperations # type: ignore
+from ._namespaces_operations import NamespacesOperations # type: ignore
+from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore
+from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore
+from ._network_security_perimeter_configuration_operations import NetworkSecurityPerimeterConfigurationOperations # type: ignore
+from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore
+from ._configuration_operations import ConfigurationOperations # type: ignore
+from ._disaster_recovery_configs_operations import DisasterRecoveryConfigsOperations # type: ignore
+from ._event_hubs_operations import EventHubsOperations # type: ignore
+from ._consumer_groups_operations import ConsumerGroupsOperations # type: ignore
+from ._operations import Operations # type: ignore
+from ._schema_registry_operations import SchemaRegistryOperations # type: ignore
+from ._application_group_operations import ApplicationGroupOperations # 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__ = [
@@ -39,5 +45,5 @@
"SchemaRegistryOperations",
"ApplicationGroupOperations",
]
-__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/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_application_group_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_application_group_operations.py
index 7eb796fb5baf7..889923a55459a 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_application_group_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_application_group_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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 (
@@ -32,7 +31,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -252,7 +251,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.ApplicationGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -397,7 +396,7 @@ def create_or_update_application_group(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.ApplicationGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -469,7 +468,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,
@@ -525,7 +524,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.ApplicationGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_clusters_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_clusters_operations.py
index 54e7c2966d299..93382737c59ca 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_clusters_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_clusters_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, Iterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -321,7 +323,7 @@ def list_available_cluster_region(self, **kwargs: Any) -> _models.AvailableClust
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AvailableClustersList
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -376,7 +378,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Cluster"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -453,7 +455,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 "2024-01-01"))
cls: ClsType[_models.ClusterListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -527,7 +529,7 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.Cluster
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -573,7 +575,7 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo
def _create_or_update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -609,6 +611,7 @@ def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -617,19 +620,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -755,7 +754,7 @@ def get_long_running_output(pipeline_response):
def _update_initial(
self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -791,6 +790,7 @@ def _update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -799,19 +799,15 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -935,7 +931,7 @@ def get_long_running_output(pipeline_response):
)
def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -959,6 +955,7 @@ def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs:
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -967,19 +964,15 @@ def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs:
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1052,7 +1045,7 @@ def list_namespaces(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.EHNamespaceIdListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_configuration_operations.py
index 13e56551fa4fd..7621472b3fe6b 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_configuration_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_configuration_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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,
@@ -30,7 +29,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -202,7 +201,7 @@ def patch(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.ClusterQuotaConfigurationProperties or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -251,11 +250,7 @@ def patch(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
+ deserialized = self._deserialize("ClusterQuotaConfigurationProperties", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -277,7 +272,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.ClusterQuotaConfigurationProperties
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_consumer_groups_operations.py
index 5dc2ca43b9690..abf89d6347837 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_consumer_groups_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_consumer_groups_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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 (
@@ -32,7 +31,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -353,7 +352,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -433,7 +432,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,
@@ -497,7 +496,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.ConsumerGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -578,7 +577,7 @@ def list_by_event_hub(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.ConsumerGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_disaster_recovery_configs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_disaster_recovery_configs_operations.py
index 84b461661e0a2..d0c8e6dd77f37 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_disaster_recovery_configs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_disaster_recovery_configs_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 (
@@ -32,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -512,7 +512,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -594,7 +594,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -657,7 +657,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -776,7 +776,7 @@ def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -852,7 +852,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.ArmDisasterRecoveryListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -999,7 +999,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1048,11 +1048,7 @@ def create_or_update(
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("ArmDisasterRecovery", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response.http_response)
+ deserialized = self._deserialize("ArmDisasterRecovery", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1075,7 +1071,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,
@@ -1131,7 +1127,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.ArmDisasterRecovery
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1192,7 +1188,7 @@ def break_pairing( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1248,7 +1244,7 @@ def fail_over( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_event_hubs_operations.py
index d8f97189e881b..5515f1b21b2ea 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_event_hubs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_event_hubs_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 (
@@ -32,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -550,7 +550,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -708,7 +708,7 @@ def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -788,7 +788,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -856,7 +856,7 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -920,7 +920,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1060,7 +1060,7 @@ def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1149,7 +1149,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.EventHubListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1296,7 +1296,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1368,7 +1368,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,
@@ -1424,7 +1424,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.Eventhub
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_namespaces_operations.py
index 7a393b559e618..e65b8fd514bf0 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_namespaces_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_namespaces_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, Iterator, 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,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -709,7 +711,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.EHNamespace"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -786,7 +788,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 "2024-01-01"))
cls: ClsType[_models.EHNamespaceListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -855,7 +857,7 @@ def _create_or_update_initial(
parameters: Union[_models.EHNamespace, IO[bytes]],
**kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -891,6 +893,7 @@ def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -899,19 +902,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 201:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1045,7 +1044,7 @@ def get_long_running_output(pipeline_response):
)
def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1069,6 +1068,7 @@ def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwarg
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -1077,19 +1077,15 @@ def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwarg
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1161,7 +1157,7 @@ def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.EHNamespace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1280,7 +1276,7 @@ def update(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.EHNamespace or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1329,11 +1325,7 @@ def update(
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
- if response.status_code == 200:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
+ deserialized = self._deserialize("EHNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1413,7 +1405,7 @@ def create_or_update_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1482,7 +1474,7 @@ def get_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.NetworkRuleSet
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1539,7 +1531,7 @@ def list_network_rule_set(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.NetworkRuleSetListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1602,7 +1594,7 @@ def list_authorization_rules(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.AuthorizationRuleListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1747,7 +1739,7 @@ def create_or_update_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1819,7 +1811,7 @@ def delete_authorization_rule( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1875,7 +1867,7 @@ def get_authorization_rule(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AuthorizationRule
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1935,7 +1927,7 @@ def list_keys(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2062,7 +2054,7 @@ def regenerate_keys(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.AccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2168,7 +2160,7 @@ def check_name_availability(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.CheckNameAvailabilityResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_network_security_perimeter_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_network_security_perimeter_configuration_operations.py
index 46cd848b2297d..13d52b20d8adc 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_network_security_perimeter_configuration_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_network_security_perimeter_configuration_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,
@@ -29,7 +28,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -111,7 +110,7 @@ def list(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.NetworkSecurityPerimeterConfigurationList
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_network_security_perimeter_configurations_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_network_security_perimeter_configurations_operations.py
index 0f97f38235538..1b13b84992361 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_network_security_perimeter_configurations_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_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, Iterator, Optional, Type, TypeVar, Union, cast
+from typing import Any, Callable, Dict, Iterator, Optional, TypeVar, Union, cast
from azure.core.exceptions import (
ClientAuthenticationError,
@@ -15,6 +14,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
@@ -31,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -103,7 +104,7 @@ def __init__(self, *args, **kwargs):
def _create_or_update_initial(
self, resource_group_name: str, namespace_name: str, resource_association_name: str, **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -128,6 +129,7 @@ def _create_or_update_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -136,16 +138,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_operations.py
index f39a1c60cfa29..d837d0334ae9d 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_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 (
@@ -31,7 +30,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -92,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 "2024-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,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_private_endpoint_connections_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_private_endpoint_connections_operations.py
index 54ad7c496cfd4..4a2159a60dfa7 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_private_endpoint_connections_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_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, Iterator, 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,6 +16,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
@@ -34,7 +35,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -271,7 +272,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-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,
@@ -428,7 +429,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -477,14 +478,7 @@ def create_or_update(
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("PrivateEndpointConnection", pipeline_response.http_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
-
- if response.status_code == 202:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -494,7 +488,7 @@ def create_or_update(
def _delete_initial(
self, resource_group_name: str, namespace_name: str, private_endpoint_connection_name: str, **kwargs: Any
) -> Iterator[bytes]:
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -519,6 +513,7 @@ def _delete_initial(
)
_request.url = self._client.format_url(_request.url)
+ _decompress = kwargs.pop("decompress", True)
_stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
@@ -527,19 +522,15 @@ def _delete_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
- response.read() # Load the body in memory and close the socket
+ 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)
- if response.status_code == 200:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 202:
- deserialized = response.stream_download(self._client._pipeline)
-
- if response.status_code == 204:
- deserialized = response.stream_download(self._client._pipeline)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -626,7 +617,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_private_link_resources_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_private_link_resources_operations.py
index 175bc4dfa3249..c631268e888c9 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_private_link_resources_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_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,
@@ -29,7 +28,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -114,7 +113,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.PrivateLinkResourcesListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_schema_registry_operations.py b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_schema_registry_operations.py
index 5ec797a134a52..b722ca2befdb3 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_schema_registry_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2024_01_01/operations/_schema_registry_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# 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 (
@@ -32,7 +31,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, HttpResponse], T, Dict[str, Any]], Any]]
@@ -268,7 +267,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-01-01"))
cls: ClsType[_models.SchemaGroupListResult] = kwargs.pop("cls", None)
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -415,7 +414,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.SchemaGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -487,7 +486,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,
@@ -543,7 +542,7 @@ def get(
:rtype: ~azure.mgmt.eventhub.v2024_01_01.models.SchemaGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map: MutableMapping[int, Type[HttpResponseError]] = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/application_group/application_group_create.py b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/application_group/application_group_create.py
index 8de151446e5ab..7fbac3f4a246e 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/application_group/application_group_create.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/application_group/application_group_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.eventhub import EventHubManagementClient
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/clusters/cluster_patch.py b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/clusters/cluster_patch.py
index 329676e96272d..60e79f23a7e2d 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/clusters/cluster_patch.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/clusters/cluster_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.eventhub import EventHubManagementClient
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/clusters/cluster_put.py b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/clusters/cluster_put.py
index b8bd57c2e58de..bba6c4d7db3dc 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/clusters/cluster_put.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/clusters/cluster_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.eventhub import EventHubManagementClient
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/clusters/cluster_quota_configuration_patch.py b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/clusters/cluster_quota_configuration_patch.py
index 046931233a112..4748e68941a4b 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/clusters/cluster_quota_configuration_patch.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/clusters/cluster_quota_configuration_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.eventhub import EventHubManagementClient
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/consumer_group/eh_consumer_group_create.py b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/consumer_group/eh_consumer_group_create.py
index 4fe4719d67027..dd1f181a8d177 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/consumer_group/eh_consumer_group_create.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/consumer_group/eh_consumer_group_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.eventhub import EventHubManagementClient
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/disaster_recovery_configs/eh_alias_check_name_availability.py b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/disaster_recovery_configs/eh_alias_check_name_availability.py
index 632ed53aaaa23..dd39fdc2b7f4e 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/disaster_recovery_configs/eh_alias_check_name_availability.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/disaster_recovery_configs/eh_alias_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.eventhub import EventHubManagementClient
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/disaster_recovery_configs/eh_alias_create.py b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/disaster_recovery_configs/eh_alias_create.py
index be750477d9b07..1f3f3e7321785 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/disaster_recovery_configs/eh_alias_create.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/disaster_recovery_configs/eh_alias_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.eventhub import EventHubManagementClient
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/event_hubs/eh_event_hub_authorization_rule_create.py b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/event_hubs/eh_event_hub_authorization_rule_create.py
index 7606ce2f43c90..37ab132afddf7 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/event_hubs/eh_event_hub_authorization_rule_create.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/event_hubs/eh_event_hub_authorization_rule_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.eventhub import EventHubManagementClient
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/event_hubs/eh_event_hub_authorization_rule_regenerate_key.py b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/event_hubs/eh_event_hub_authorization_rule_regenerate_key.py
index 9372cd36d417a..5ff0d78918b91 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/event_hubs/eh_event_hub_authorization_rule_regenerate_key.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/event_hubs/eh_event_hub_authorization_rule_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.eventhub import EventHubManagementClient
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/event_hubs/eh_event_hub_create.py b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/event_hubs/eh_event_hub_create.py
index ad68ce3baf63a..5be4a7736ca63 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/event_hubs/eh_event_hub_create.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/event_hubs/eh_event_hub_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.eventhub import EventHubManagementClient
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/eh_name_space_authorization_rule_create.py b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/eh_name_space_authorization_rule_create.py
index ac9a19a0ad1c2..fd42a0f9394ec 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/eh_name_space_authorization_rule_create.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/eh_name_space_authorization_rule_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.eventhub import EventHubManagementClient
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/eh_name_space_authorization_rule_regenerate_key.py b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/eh_name_space_authorization_rule_regenerate_key.py
index dcb24d9a79a7a..be3ab36a57b5e 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/eh_name_space_authorization_rule_regenerate_key.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/eh_name_space_authorization_rule_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.eventhub import EventHubManagementClient
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/eh_name_space_check_name_availability.py b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/eh_name_space_check_name_availability.py
index bf30ca04ac340..56b3044efde6d 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/eh_name_space_check_name_availability.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/eh_name_space_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.eventhub import EventHubManagementClient
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/eh_name_space_create.py b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/eh_name_space_create.py
index 30a92b9d1711c..34332b3620d56 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/eh_name_space_create.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/eh_name_space_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.eventhub import EventHubManagementClient
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/eh_name_space_update.py b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/eh_name_space_update.py
index 35435fb6b5f4f..dfd467a9fa489 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/eh_name_space_update.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/eh_name_space_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.eventhub import EventHubManagementClient
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/private_end_point_connection_create.py b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/private_end_point_connection_create.py
index de91d600b4b78..0c3bb3f0af714 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/private_end_point_connection_create.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/private_end_point_connection_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.eventhub import EventHubManagementClient
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/virtual_network_rule/eh_network_rule_set_create.py b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/virtual_network_rule/eh_network_rule_set_create.py
index 51f1ca310eae4..e06ad26911331 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/virtual_network_rule/eh_network_rule_set_create.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/name_spaces/virtual_network_rule/eh_network_rule_set_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.eventhub import EventHubManagementClient
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/schema_registry/schema_registry_create.py b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/schema_registry/schema_registry_create.py
index 10a4c6ec77316..5752281e5519c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_samples/schema_registry/schema_registry_create.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_samples/schema_registry/schema_registry_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.eventhub import EventHubManagementClient
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/conftest.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/conftest.py
index 3f052d8e7e8cd..57e6590178511 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/conftest.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/conftest.py
@@ -18,7 +18,7 @@
load_dotenv()
-# aovid record sensitive identity information in recordings
+# For security, please avoid record sensitive identity information in recordings
@pytest.fixture(scope="session", autouse=True)
def add_sanitizers(test_proxy):
eventhubmanagement_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_application_group_operations.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_application_group_operations.py
index e15643101f218..84af0e7670426 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_application_group_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_application_group_operations.py
@@ -20,11 +20,11 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_list_by_namespace(self, resource_group):
+ def test_application_group_list_by_namespace(self, resource_group):
response = self.client.application_group.list_by_namespace(
resource_group_name=resource_group.name,
namespace_name="str",
- api_version="2022-10-01-preview",
+ api_version="2024-01-01",
)
result = [r for r in response]
# please add some check logic here by yourself
@@ -32,7 +32,7 @@ def test_list_by_namespace(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_create_or_update_application_group(self, resource_group):
+ def test_application_group_create_or_update_application_group(self, resource_group):
response = self.client.application_group.create_or_update_application_group(
resource_group_name=resource_group.name,
namespace_name="str",
@@ -54,7 +54,7 @@ def test_create_or_update_application_group(self, resource_group):
},
"type": "str",
},
- api_version="2022-10-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -62,12 +62,12 @@ def test_create_or_update_application_group(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_delete(self, resource_group):
+ def test_application_group_delete(self, resource_group):
response = self.client.application_group.delete(
resource_group_name=resource_group.name,
namespace_name="str",
application_group_name="str",
- api_version="2022-10-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -75,12 +75,12 @@ def test_delete(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_get(self, resource_group):
+ def test_application_group_get(self, resource_group):
response = self.client.application_group.get(
resource_group_name=resource_group.name,
namespace_name="str",
application_group_name="str",
- api_version="2022-10-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_application_group_operations_async.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_application_group_operations_async.py
index 0098c7a1e5e99..648558fac318e 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_application_group_operations_async.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_application_group_operations_async.py
@@ -21,11 +21,11 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_list_by_namespace(self, resource_group):
+ async def test_application_group_list_by_namespace(self, resource_group):
response = self.client.application_group.list_by_namespace(
resource_group_name=resource_group.name,
namespace_name="str",
- api_version="2022-10-01-preview",
+ api_version="2024-01-01",
)
result = [r async for r in response]
# please add some check logic here by yourself
@@ -33,7 +33,7 @@ async def test_list_by_namespace(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_create_or_update_application_group(self, resource_group):
+ async def test_application_group_create_or_update_application_group(self, resource_group):
response = await self.client.application_group.create_or_update_application_group(
resource_group_name=resource_group.name,
namespace_name="str",
@@ -55,7 +55,7 @@ async def test_create_or_update_application_group(self, resource_group):
},
"type": "str",
},
- api_version="2022-10-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -63,12 +63,12 @@ async def test_create_or_update_application_group(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_delete(self, resource_group):
+ async def test_application_group_delete(self, resource_group):
response = await self.client.application_group.delete(
resource_group_name=resource_group.name,
namespace_name="str",
application_group_name="str",
- api_version="2022-10-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -76,12 +76,12 @@ async def test_delete(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_get(self, resource_group):
+ async def test_application_group_get(self, resource_group):
response = await self.client.application_group.get(
resource_group_name=resource_group.name,
namespace_name="str",
application_group_name="str",
- api_version="2022-10-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_clusters_operations.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_clusters_operations.py
index f867e7c3f4e8d..d57fa9f4b369a 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_clusters_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_clusters_operations.py
@@ -20,9 +20,9 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_list_available_cluster_region(self, resource_group):
+ def test_clusters_list_available_cluster_region(self, resource_group):
response = self.client.clusters.list_available_cluster_region(
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -30,10 +30,20 @@ def test_list_available_cluster_region(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_list_by_resource_group(self, resource_group):
+ def test_clusters_list_by_subscription(self, resource_group):
+ response = self.client.clusters.list_by_subscription(
+ api_version="2024-01-01",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_clusters_list_by_resource_group(self, resource_group):
response = self.client.clusters.list_by_resource_group(
resource_group_name=resource_group.name,
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
result = [r for r in response]
# please add some check logic here by yourself
@@ -41,11 +51,11 @@ def test_list_by_resource_group(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_get(self, resource_group):
+ def test_clusters_get(self, resource_group):
response = self.client.clusters.get(
resource_group_name=resource_group.name,
cluster_name="str",
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -53,7 +63,7 @@ def test_get(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_begin_create_or_update(self, resource_group):
+ def test_clusters_begin_create_or_update(self, resource_group):
response = self.client.clusters.begin_create_or_update(
resource_group_name=resource_group.name,
cluster_name="str",
@@ -63,13 +73,23 @@ def test_begin_create_or_update(self, resource_group):
"location": "str",
"metricId": "str",
"name": "str",
+ "provisioningState": "str",
"sku": {"name": "str", "capacity": 0},
"status": "str",
+ "supportsScaling": bool,
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
"tags": {"str": "str"},
"type": "str",
"updatedAt": "str",
},
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
@@ -77,7 +97,7 @@ def test_begin_create_or_update(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_begin_update(self, resource_group):
+ def test_clusters_begin_update(self, resource_group):
response = self.client.clusters.begin_update(
resource_group_name=resource_group.name,
cluster_name="str",
@@ -87,13 +107,23 @@ def test_begin_update(self, resource_group):
"location": "str",
"metricId": "str",
"name": "str",
+ "provisioningState": "str",
"sku": {"name": "str", "capacity": 0},
"status": "str",
+ "supportsScaling": bool,
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
"tags": {"str": "str"},
"type": "str",
"updatedAt": "str",
},
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
@@ -101,11 +131,11 @@ def test_begin_update(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_begin_delete(self, resource_group):
+ def test_clusters_begin_delete(self, resource_group):
response = self.client.clusters.begin_delete(
resource_group_name=resource_group.name,
cluster_name="str",
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
@@ -113,11 +143,11 @@ def test_begin_delete(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_list_namespaces(self, resource_group):
+ def test_clusters_list_namespaces(self, resource_group):
response = self.client.clusters.list_namespaces(
resource_group_name=resource_group.name,
cluster_name="str",
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_clusters_operations_async.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_clusters_operations_async.py
index d45b1dc4ed684..105062f1a5535 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_clusters_operations_async.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_clusters_operations_async.py
@@ -21,9 +21,9 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_list_available_cluster_region(self, resource_group):
+ async def test_clusters_list_available_cluster_region(self, resource_group):
response = await self.client.clusters.list_available_cluster_region(
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -31,10 +31,20 @@ async def test_list_available_cluster_region(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_list_by_resource_group(self, resource_group):
+ async def test_clusters_list_by_subscription(self, resource_group):
+ response = self.client.clusters.list_by_subscription(
+ api_version="2024-01-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_clusters_list_by_resource_group(self, resource_group):
response = self.client.clusters.list_by_resource_group(
resource_group_name=resource_group.name,
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
result = [r async for r in response]
# please add some check logic here by yourself
@@ -42,11 +52,11 @@ async def test_list_by_resource_group(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_get(self, resource_group):
+ async def test_clusters_get(self, resource_group):
response = await self.client.clusters.get(
resource_group_name=resource_group.name,
cluster_name="str",
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -54,7 +64,7 @@ async def test_get(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_begin_create_or_update(self, resource_group):
+ async def test_clusters_begin_create_or_update(self, resource_group):
response = await (
await self.client.clusters.begin_create_or_update(
resource_group_name=resource_group.name,
@@ -65,13 +75,23 @@ async def test_begin_create_or_update(self, resource_group):
"location": "str",
"metricId": "str",
"name": "str",
+ "provisioningState": "str",
"sku": {"name": "str", "capacity": 0},
"status": "str",
+ "supportsScaling": bool,
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
"tags": {"str": "str"},
"type": "str",
"updatedAt": "str",
},
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
).result() # call '.result()' to poll until service return final result
@@ -80,7 +100,7 @@ async def test_begin_create_or_update(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_begin_update(self, resource_group):
+ async def test_clusters_begin_update(self, resource_group):
response = await (
await self.client.clusters.begin_update(
resource_group_name=resource_group.name,
@@ -91,13 +111,23 @@ async def test_begin_update(self, resource_group):
"location": "str",
"metricId": "str",
"name": "str",
+ "provisioningState": "str",
"sku": {"name": "str", "capacity": 0},
"status": "str",
+ "supportsScaling": bool,
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
"tags": {"str": "str"},
"type": "str",
"updatedAt": "str",
},
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
).result() # call '.result()' to poll until service return final result
@@ -106,12 +136,12 @@ async def test_begin_update(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_begin_delete(self, resource_group):
+ async def test_clusters_begin_delete(self, resource_group):
response = await (
await self.client.clusters.begin_delete(
resource_group_name=resource_group.name,
cluster_name="str",
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
).result() # call '.result()' to poll until service return final result
@@ -120,11 +150,11 @@ async def test_begin_delete(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_list_namespaces(self, resource_group):
+ async def test_clusters_list_namespaces(self, resource_group):
response = await self.client.clusters.list_namespaces(
resource_group_name=resource_group.name,
cluster_name="str",
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_configuration_operations.py
index 98e042abfd715..b19322d119290 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_configuration_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_configuration_operations.py
@@ -20,12 +20,12 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_patch(self, resource_group):
+ def test_configuration_patch(self, resource_group):
response = self.client.configuration.patch(
resource_group_name=resource_group.name,
cluster_name="str",
parameters={"settings": {"str": "str"}},
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -33,11 +33,11 @@ def test_patch(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_get(self, resource_group):
+ def test_configuration_get(self, resource_group):
response = self.client.configuration.get(
resource_group_name=resource_group.name,
cluster_name="str",
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_configuration_operations_async.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_configuration_operations_async.py
index a951c69bcb643..a38c73df5aecd 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_configuration_operations_async.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_configuration_operations_async.py
@@ -21,12 +21,12 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_patch(self, resource_group):
+ async def test_configuration_patch(self, resource_group):
response = await self.client.configuration.patch(
resource_group_name=resource_group.name,
cluster_name="str",
parameters={"settings": {"str": "str"}},
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -34,11 +34,11 @@ async def test_patch(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_get(self, resource_group):
+ async def test_configuration_get(self, resource_group):
response = await self.client.configuration.get(
resource_group_name=resource_group.name,
cluster_name="str",
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_consumer_groups_operations.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_consumer_groups_operations.py
index f8fde8492468e..65584c708f6f6 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_consumer_groups_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_consumer_groups_operations.py
@@ -20,22 +20,30 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_create_or_update(self, resource_group):
+ def test_consumer_groups_create_or_update(self, resource_group):
response = self.client.consumer_groups.create_or_update(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
consumer_group_name="str",
parameters={
- "location": "str",
"createdAt": "2020-02-20 00:00:00",
- "eventHubPath": "str",
+ "id": "str",
+ "location": "str",
"name": "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",
"updatedAt": "2020-02-20 00:00:00",
"userMetadata": "str",
},
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -43,13 +51,13 @@ def test_create_or_update(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_delete(self, resource_group):
+ def test_consumer_groups_delete(self, resource_group):
response = self.client.consumer_groups.delete(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
consumer_group_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -57,13 +65,13 @@ def test_delete(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_get(self, resource_group):
+ def test_consumer_groups_get(self, resource_group):
response = self.client.consumer_groups.get(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
consumer_group_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -71,12 +79,12 @@ def test_get(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_list_all(self, resource_group):
- response = self.client.consumer_groups.list_all(
+ def test_consumer_groups_list_by_event_hub(self, resource_group):
+ response = self.client.consumer_groups.list_by_event_hub(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
result = [r for r in response]
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_consumer_groups_operations_async.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_consumer_groups_operations_async.py
index 5e599a49282f1..206c2b0d56b9d 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_consumer_groups_operations_async.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_consumer_groups_operations_async.py
@@ -21,22 +21,30 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_create_or_update(self, resource_group):
+ async def test_consumer_groups_create_or_update(self, resource_group):
response = await self.client.consumer_groups.create_or_update(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
consumer_group_name="str",
parameters={
- "location": "str",
"createdAt": "2020-02-20 00:00:00",
- "eventHubPath": "str",
+ "id": "str",
+ "location": "str",
"name": "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",
"updatedAt": "2020-02-20 00:00:00",
"userMetadata": "str",
},
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -44,13 +52,13 @@ async def test_create_or_update(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_delete(self, resource_group):
+ async def test_consumer_groups_delete(self, resource_group):
response = await self.client.consumer_groups.delete(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
consumer_group_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -58,13 +66,13 @@ async def test_delete(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_get(self, resource_group):
+ async def test_consumer_groups_get(self, resource_group):
response = await self.client.consumer_groups.get(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
consumer_group_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -72,12 +80,12 @@ async def test_get(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_list_all(self, resource_group):
- response = self.client.consumer_groups.list_all(
+ async def test_consumer_groups_list_by_event_hub(self, resource_group):
+ response = self.client.consumer_groups.list_by_event_hub(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
result = [r async for r in response]
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_disaster_recovery_configs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_disaster_recovery_configs_operations.py
index bf09e8eb6982e..67ff92ff52cf6 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_disaster_recovery_configs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_disaster_recovery_configs_operations.py
@@ -20,12 +20,12 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_list_authorization_rules(self, resource_group):
+ def test_disaster_recovery_configs_list_authorization_rules(self, resource_group):
response = self.client.disaster_recovery_configs.list_authorization_rules(
resource_group_name=resource_group.name,
namespace_name="str",
alias="str",
- api_version="2017-04-01",
+ api_version="2024-01-01",
)
result = [r for r in response]
# please add some check logic here by yourself
@@ -33,13 +33,13 @@ def test_list_authorization_rules(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_get_authorization_rule(self, resource_group):
+ def test_disaster_recovery_configs_get_authorization_rule(self, resource_group):
response = self.client.disaster_recovery_configs.get_authorization_rule(
resource_group_name=resource_group.name,
namespace_name="str",
alias="str",
authorization_rule_name="str",
- api_version="2017-04-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -47,13 +47,13 @@ def test_get_authorization_rule(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_list_keys(self, resource_group):
+ def test_disaster_recovery_configs_list_keys(self, resource_group):
response = self.client.disaster_recovery_configs.list_keys(
resource_group_name=resource_group.name,
namespace_name="str",
alias="str",
authorization_rule_name="str",
- api_version="2017-04-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -61,12 +61,12 @@ def test_list_keys(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_check_name_availability(self, resource_group):
+ def test_disaster_recovery_configs_check_name_availability(self, resource_group):
response = self.client.disaster_recovery_configs.check_name_availability(
resource_group_name=resource_group.name,
namespace_name="str",
parameters={"name": "str"},
- api_version="2017-04-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -74,11 +74,11 @@ def test_check_name_availability(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_list(self, resource_group):
+ def test_disaster_recovery_configs_list(self, resource_group):
response = self.client.disaster_recovery_configs.list(
resource_group_name=resource_group.name,
namespace_name="str",
- api_version="2017-04-01",
+ api_version="2024-01-01",
)
result = [r for r in response]
# please add some check logic here by yourself
@@ -86,7 +86,7 @@ def test_list(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_create_or_update(self, resource_group):
+ def test_disaster_recovery_configs_create_or_update(self, resource_group):
response = self.client.disaster_recovery_configs.create_or_update(
resource_group_name=resource_group.name,
namespace_name="str",
@@ -94,14 +94,23 @@ def test_create_or_update(self, resource_group):
parameters={
"alternateName": "str",
"id": "str",
+ "location": "str",
"name": "str",
"partnerNamespace": "str",
"pendingReplicationOperationsCount": 0,
"provisioningState": "str",
"role": "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="2017-04-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -109,12 +118,12 @@ def test_create_or_update(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_delete(self, resource_group):
+ def test_disaster_recovery_configs_delete(self, resource_group):
response = self.client.disaster_recovery_configs.delete(
resource_group_name=resource_group.name,
namespace_name="str",
alias="str",
- api_version="2017-04-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -122,12 +131,12 @@ def test_delete(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_get(self, resource_group):
+ def test_disaster_recovery_configs_get(self, resource_group):
response = self.client.disaster_recovery_configs.get(
resource_group_name=resource_group.name,
namespace_name="str",
alias="str",
- api_version="2017-04-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -135,12 +144,12 @@ def test_get(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_break_pairing(self, resource_group):
+ def test_disaster_recovery_configs_break_pairing(self, resource_group):
response = self.client.disaster_recovery_configs.break_pairing(
resource_group_name=resource_group.name,
namespace_name="str",
alias="str",
- api_version="2017-04-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -148,12 +157,12 @@ def test_break_pairing(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_fail_over(self, resource_group):
+ def test_disaster_recovery_configs_fail_over(self, resource_group):
response = self.client.disaster_recovery_configs.fail_over(
resource_group_name=resource_group.name,
namespace_name="str",
alias="str",
- api_version="2017-04-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_disaster_recovery_configs_operations_async.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_disaster_recovery_configs_operations_async.py
index 8c6411c2ceebe..d905b6abd934d 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_disaster_recovery_configs_operations_async.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_disaster_recovery_configs_operations_async.py
@@ -21,12 +21,12 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_list_authorization_rules(self, resource_group):
+ async def test_disaster_recovery_configs_list_authorization_rules(self, resource_group):
response = self.client.disaster_recovery_configs.list_authorization_rules(
resource_group_name=resource_group.name,
namespace_name="str",
alias="str",
- api_version="2017-04-01",
+ api_version="2024-01-01",
)
result = [r async for r in response]
# please add some check logic here by yourself
@@ -34,13 +34,13 @@ async def test_list_authorization_rules(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_get_authorization_rule(self, resource_group):
+ async def test_disaster_recovery_configs_get_authorization_rule(self, resource_group):
response = await self.client.disaster_recovery_configs.get_authorization_rule(
resource_group_name=resource_group.name,
namespace_name="str",
alias="str",
authorization_rule_name="str",
- api_version="2017-04-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -48,13 +48,13 @@ async def test_get_authorization_rule(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_list_keys(self, resource_group):
+ async def test_disaster_recovery_configs_list_keys(self, resource_group):
response = await self.client.disaster_recovery_configs.list_keys(
resource_group_name=resource_group.name,
namespace_name="str",
alias="str",
authorization_rule_name="str",
- api_version="2017-04-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -62,12 +62,12 @@ async def test_list_keys(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_check_name_availability(self, resource_group):
+ async def test_disaster_recovery_configs_check_name_availability(self, resource_group):
response = await self.client.disaster_recovery_configs.check_name_availability(
resource_group_name=resource_group.name,
namespace_name="str",
parameters={"name": "str"},
- api_version="2017-04-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -75,11 +75,11 @@ async def test_check_name_availability(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_list(self, resource_group):
+ async def test_disaster_recovery_configs_list(self, resource_group):
response = self.client.disaster_recovery_configs.list(
resource_group_name=resource_group.name,
namespace_name="str",
- api_version="2017-04-01",
+ api_version="2024-01-01",
)
result = [r async for r in response]
# please add some check logic here by yourself
@@ -87,7 +87,7 @@ async def test_list(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_create_or_update(self, resource_group):
+ async def test_disaster_recovery_configs_create_or_update(self, resource_group):
response = await self.client.disaster_recovery_configs.create_or_update(
resource_group_name=resource_group.name,
namespace_name="str",
@@ -95,14 +95,23 @@ async def test_create_or_update(self, resource_group):
parameters={
"alternateName": "str",
"id": "str",
+ "location": "str",
"name": "str",
"partnerNamespace": "str",
"pendingReplicationOperationsCount": 0,
"provisioningState": "str",
"role": "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="2017-04-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -110,12 +119,12 @@ async def test_create_or_update(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_delete(self, resource_group):
+ async def test_disaster_recovery_configs_delete(self, resource_group):
response = await self.client.disaster_recovery_configs.delete(
resource_group_name=resource_group.name,
namespace_name="str",
alias="str",
- api_version="2017-04-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -123,12 +132,12 @@ async def test_delete(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_get(self, resource_group):
+ async def test_disaster_recovery_configs_get(self, resource_group):
response = await self.client.disaster_recovery_configs.get(
resource_group_name=resource_group.name,
namespace_name="str",
alias="str",
- api_version="2017-04-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -136,12 +145,12 @@ async def test_get(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_break_pairing(self, resource_group):
+ async def test_disaster_recovery_configs_break_pairing(self, resource_group):
response = await self.client.disaster_recovery_configs.break_pairing(
resource_group_name=resource_group.name,
namespace_name="str",
alias="str",
- api_version="2017-04-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -149,12 +158,12 @@ async def test_break_pairing(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_fail_over(self, resource_group):
+ async def test_disaster_recovery_configs_fail_over(self, resource_group):
response = await self.client.disaster_recovery_configs.fail_over(
resource_group_name=resource_group.name,
namespace_name="str",
alias="str",
- api_version="2017-04-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_event_hubs_operations.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_event_hubs_operations.py
index d9316b9c75e4b..1ed8c2cf7d11a 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_event_hubs_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_event_hubs_operations.py
@@ -20,11 +20,12 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_list_all(self, resource_group):
- response = self.client.event_hubs.list_all(
+ def test_event_hubs_list_authorization_rules(self, resource_group):
+ response = self.client.event_hubs.list_authorization_rules(
resource_group_name=resource_group.name,
namespace_name="str",
- api_version="2015-08-01",
+ event_hub_name="str",
+ api_version="2024-01-01",
)
result = [r for r in response]
# please add some check logic here by yourself
@@ -32,23 +33,28 @@ def test_list_all(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_create_or_update(self, resource_group):
- response = self.client.event_hubs.create_or_update(
+ def test_event_hubs_create_or_update_authorization_rule(self, resource_group):
+ response = self.client.event_hubs.create_or_update_authorization_rule(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
+ authorization_rule_name="str",
parameters={
+ "id": "str",
"location": "str",
- "createdAt": "2020-02-20 00:00:00",
- "messageRetentionInDays": 0,
"name": "str",
- "partitionCount": 0,
- "partitionIds": ["str"],
- "status": "str",
+ "rights": ["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",
- "updatedAt": "2020-02-20 00:00:00",
},
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -56,12 +62,13 @@ def test_create_or_update(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_delete(self, resource_group):
- response = self.client.event_hubs.delete(
+ def test_event_hubs_get_authorization_rule(self, resource_group):
+ response = self.client.event_hubs.get_authorization_rule(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
- api_version="2015-08-01",
+ authorization_rule_name="str",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -69,12 +76,13 @@ def test_delete(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_get(self, resource_group):
- response = self.client.event_hubs.get(
+ def test_event_hubs_delete_authorization_rule(self, resource_group):
+ response = self.client.event_hubs.delete_authorization_rule(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
- api_version="2015-08-01",
+ authorization_rule_name="str",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -82,27 +90,13 @@ def test_get(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_list_authorization_rules(self, resource_group):
- response = self.client.event_hubs.list_authorization_rules(
- resource_group_name=resource_group.name,
- namespace_name="str",
- event_hub_name="str",
- api_version="2015-08-01",
- )
- result = [r for r in response]
- # please add some check logic here by yourself
- # ...
-
- @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
- @recorded_by_proxy
- def test_create_or_update_authorization_rule(self, resource_group):
- response = self.client.event_hubs.create_or_update_authorization_rule(
+ def test_event_hubs_list_keys(self, resource_group):
+ response = self.client.event_hubs.list_keys(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
authorization_rule_name="str",
- parameters={"location": "str", "name": "str", "rights": ["str"]},
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -110,13 +104,14 @@ def test_create_or_update_authorization_rule(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_get_authorization_rule(self, resource_group):
- response = self.client.event_hubs.get_authorization_rule(
+ def test_event_hubs_regenerate_keys(self, resource_group):
+ response = self.client.event_hubs.regenerate_keys(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
authorization_rule_name="str",
- api_version="2015-08-01",
+ parameters={"keyType": "str", "key": "str"},
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -124,27 +119,67 @@ def test_get_authorization_rule(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_post_authorization_rule(self, resource_group):
- response = self.client.event_hubs.post_authorization_rule(
+ def test_event_hubs_list_by_namespace(self, resource_group):
+ response = self.client.event_hubs.list_by_namespace(
resource_group_name=resource_group.name,
namespace_name="str",
- event_hub_name="str",
- authorization_rule_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
-
+ result = [r for r in response]
# please add some check logic here by yourself
# ...
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_delete_authorization_rule(self, resource_group):
- response = self.client.event_hubs.delete_authorization_rule(
+ def test_event_hubs_create_or_update(self, resource_group):
+ response = self.client.event_hubs.create_or_update(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
- authorization_rule_name="str",
- api_version="2015-08-01",
+ parameters={
+ "captureDescription": {
+ "destination": {
+ "archiveNameFormat": "str",
+ "blobContainer": "str",
+ "dataLakeAccountName": "str",
+ "dataLakeFolderPath": "str",
+ "dataLakeSubscriptionId": "str",
+ "identity": {"type": "str", "userAssignedIdentity": "str"},
+ "name": "str",
+ "storageAccountResourceId": "str",
+ },
+ "enabled": bool,
+ "encoding": "str",
+ "intervalInSeconds": 0,
+ "sizeLimitInBytes": 0,
+ "skipEmptyArchives": bool,
+ },
+ "createdAt": "2020-02-20 00:00:00",
+ "id": "str",
+ "location": "str",
+ "messageRetentionInDays": 0,
+ "name": "str",
+ "partitionCount": 0,
+ "partitionIds": ["str"],
+ "retentionDescription": {
+ "cleanupPolicy": "str",
+ "retentionTimeInHours": 0,
+ "tombstoneRetentionTimeInHours": 0,
+ },
+ "status": "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",
+ "updatedAt": "2020-02-20 00:00:00",
+ "userMetadata": "str",
+ },
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -152,13 +187,12 @@ def test_delete_authorization_rule(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_list_keys(self, resource_group):
- response = self.client.event_hubs.list_keys(
+ def test_event_hubs_delete(self, resource_group):
+ response = self.client.event_hubs.delete(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
- authorization_rule_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -166,14 +200,12 @@ def test_list_keys(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_regenerate_keys(self, resource_group):
- response = self.client.event_hubs.regenerate_keys(
+ def test_event_hubs_get(self, resource_group):
+ response = self.client.event_hubs.get(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
- authorization_rule_name="str",
- parameters={"policykey": "str"},
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_event_hubs_operations_async.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_event_hubs_operations_async.py
index 773bf874b018a..c890f73d65a92 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_event_hubs_operations_async.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_event_hubs_operations_async.py
@@ -21,11 +21,12 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_list_all(self, resource_group):
- response = self.client.event_hubs.list_all(
+ async def test_event_hubs_list_authorization_rules(self, resource_group):
+ response = self.client.event_hubs.list_authorization_rules(
resource_group_name=resource_group.name,
namespace_name="str",
- api_version="2015-08-01",
+ event_hub_name="str",
+ api_version="2024-01-01",
)
result = [r async for r in response]
# please add some check logic here by yourself
@@ -33,23 +34,28 @@ async def test_list_all(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_create_or_update(self, resource_group):
- response = await self.client.event_hubs.create_or_update(
+ async def test_event_hubs_create_or_update_authorization_rule(self, resource_group):
+ response = await self.client.event_hubs.create_or_update_authorization_rule(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
+ authorization_rule_name="str",
parameters={
+ "id": "str",
"location": "str",
- "createdAt": "2020-02-20 00:00:00",
- "messageRetentionInDays": 0,
"name": "str",
- "partitionCount": 0,
- "partitionIds": ["str"],
- "status": "str",
+ "rights": ["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",
- "updatedAt": "2020-02-20 00:00:00",
},
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -57,12 +63,13 @@ async def test_create_or_update(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_delete(self, resource_group):
- response = await self.client.event_hubs.delete(
+ async def test_event_hubs_get_authorization_rule(self, resource_group):
+ response = await self.client.event_hubs.get_authorization_rule(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
- api_version="2015-08-01",
+ authorization_rule_name="str",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -70,12 +77,13 @@ async def test_delete(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_get(self, resource_group):
- response = await self.client.event_hubs.get(
+ async def test_event_hubs_delete_authorization_rule(self, resource_group):
+ response = await self.client.event_hubs.delete_authorization_rule(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
- api_version="2015-08-01",
+ authorization_rule_name="str",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -83,27 +91,13 @@ async def test_get(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_list_authorization_rules(self, resource_group):
- response = self.client.event_hubs.list_authorization_rules(
- resource_group_name=resource_group.name,
- namespace_name="str",
- event_hub_name="str",
- api_version="2015-08-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_create_or_update_authorization_rule(self, resource_group):
- response = await self.client.event_hubs.create_or_update_authorization_rule(
+ async def test_event_hubs_list_keys(self, resource_group):
+ response = await self.client.event_hubs.list_keys(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
authorization_rule_name="str",
- parameters={"location": "str", "name": "str", "rights": ["str"]},
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -111,13 +105,14 @@ async def test_create_or_update_authorization_rule(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_get_authorization_rule(self, resource_group):
- response = await self.client.event_hubs.get_authorization_rule(
+ async def test_event_hubs_regenerate_keys(self, resource_group):
+ response = await self.client.event_hubs.regenerate_keys(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
authorization_rule_name="str",
- api_version="2015-08-01",
+ parameters={"keyType": "str", "key": "str"},
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -125,27 +120,67 @@ async def test_get_authorization_rule(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_post_authorization_rule(self, resource_group):
- response = await self.client.event_hubs.post_authorization_rule(
+ async def test_event_hubs_list_by_namespace(self, resource_group):
+ response = self.client.event_hubs.list_by_namespace(
resource_group_name=resource_group.name,
namespace_name="str",
- event_hub_name="str",
- authorization_rule_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-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_delete_authorization_rule(self, resource_group):
- response = await self.client.event_hubs.delete_authorization_rule(
+ async def test_event_hubs_create_or_update(self, resource_group):
+ response = await self.client.event_hubs.create_or_update(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
- authorization_rule_name="str",
- api_version="2015-08-01",
+ parameters={
+ "captureDescription": {
+ "destination": {
+ "archiveNameFormat": "str",
+ "blobContainer": "str",
+ "dataLakeAccountName": "str",
+ "dataLakeFolderPath": "str",
+ "dataLakeSubscriptionId": "str",
+ "identity": {"type": "str", "userAssignedIdentity": "str"},
+ "name": "str",
+ "storageAccountResourceId": "str",
+ },
+ "enabled": bool,
+ "encoding": "str",
+ "intervalInSeconds": 0,
+ "sizeLimitInBytes": 0,
+ "skipEmptyArchives": bool,
+ },
+ "createdAt": "2020-02-20 00:00:00",
+ "id": "str",
+ "location": "str",
+ "messageRetentionInDays": 0,
+ "name": "str",
+ "partitionCount": 0,
+ "partitionIds": ["str"],
+ "retentionDescription": {
+ "cleanupPolicy": "str",
+ "retentionTimeInHours": 0,
+ "tombstoneRetentionTimeInHours": 0,
+ },
+ "status": "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",
+ "updatedAt": "2020-02-20 00:00:00",
+ "userMetadata": "str",
+ },
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -153,13 +188,12 @@ async def test_delete_authorization_rule(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_list_keys(self, resource_group):
- response = await self.client.event_hubs.list_keys(
+ async def test_event_hubs_delete(self, resource_group):
+ response = await self.client.event_hubs.delete(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
- authorization_rule_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -167,14 +201,12 @@ async def test_list_keys(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_regenerate_keys(self, resource_group):
- response = await self.client.event_hubs.regenerate_keys(
+ async def test_event_hubs_get(self, resource_group):
+ response = await self.client.event_hubs.get(
resource_group_name=resource_group.name,
namespace_name="str",
event_hub_name="str",
- authorization_rule_name="str",
- parameters={"policykey": "str"},
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_namespaces_operations.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_namespaces_operations.py
index b3d2d083bb472..f7e5422fced54 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_namespaces_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_namespaces_operations.py
@@ -20,20 +20,9 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_check_name_availability(self, resource_group):
- response = self.client.namespaces.check_name_availability(
- parameters={"name": "str"},
- api_version="2015-08-01",
- )
-
- # please add some check logic here by yourself
- # ...
-
- @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
- @recorded_by_proxy
- def test_list_by_subscription(self, resource_group):
- response = self.client.namespaces.list_by_subscription(
- api_version="2015-08-01",
+ def test_namespaces_list(self, resource_group):
+ response = self.client.namespaces.list(
+ api_version="2024-01-01",
)
result = [r for r in response]
# please add some check logic here by yourself
@@ -41,10 +30,10 @@ def test_list_by_subscription(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_list_by_resource_group(self, resource_group):
+ def test_namespaces_list_by_resource_group(self, resource_group):
response = self.client.namespaces.list_by_resource_group(
resource_group_name=resource_group.name,
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
result = [r for r in response]
# please add some check logic here by yourself
@@ -52,23 +41,79 @@ def test_list_by_resource_group(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_begin_create_or_update(self, resource_group):
+ def test_namespaces_begin_create_or_update(self, resource_group):
response = self.client.namespaces.begin_create_or_update(
resource_group_name=resource_group.name,
namespace_name="str",
parameters={
- "location": "str",
+ "alternateName": "str",
+ "clusterArmId": "str",
"createdAt": "2020-02-20 00:00:00",
- "enabled": bool,
+ "disableLocalAuth": bool,
+ "encryption": {
+ "keySource": "Microsoft.KeyVault",
+ "keyVaultProperties": [
+ {
+ "identity": {"userAssignedIdentity": "str"},
+ "keyName": "str",
+ "keyVaultUri": "str",
+ "keyVersion": "str",
+ }
+ ],
+ "requireInfrastructureEncryption": bool,
+ },
+ "id": "str",
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "isAutoInflateEnabled": bool,
+ "kafkaEnabled": bool,
+ "location": "str",
+ "maximumThroughputUnits": 0,
"metricId": "str",
+ "minimumTlsVersion": "str",
+ "name": "str",
+ "privateEndpointConnections": [
+ {
+ "id": "str",
+ "location": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {"description": "str", "status": "str"},
+ "provisioningState": "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",
+ }
+ ],
"provisioningState": "str",
+ "publicNetworkAccess": "Enabled",
"serviceBusEndpoint": "str",
- "sku": {"tier": "str", "capacity": 0, "name": "str"},
+ "sku": {"name": "str", "capacity": 0, "tier": "str"},
"status": "str",
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
"tags": {"str": "str"},
+ "type": "str",
"updatedAt": "2020-02-20 00:00:00",
+ "zoneRedundant": bool,
},
- api_version="2015-08-01",
+ api_version="2024-01-01",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
@@ -76,11 +121,11 @@ def test_begin_create_or_update(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_begin_delete(self, resource_group):
+ def test_namespaces_begin_delete(self, resource_group):
response = self.client.namespaces.begin_delete(
resource_group_name=resource_group.name,
namespace_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-01",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
@@ -88,11 +133,11 @@ def test_begin_delete(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_get(self, resource_group):
+ def test_namespaces_get(self, resource_group):
response = self.client.namespaces.get(
resource_group_name=resource_group.name,
namespace_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -100,12 +145,79 @@ def test_get(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_update(self, resource_group):
+ def test_namespaces_update(self, resource_group):
response = self.client.namespaces.update(
resource_group_name=resource_group.name,
namespace_name="str",
- parameters={"sku": {"tier": "str", "capacity": 0, "name": "str"}, "tags": {"str": "str"}},
- api_version="2015-08-01",
+ parameters={
+ "alternateName": "str",
+ "clusterArmId": "str",
+ "createdAt": "2020-02-20 00:00:00",
+ "disableLocalAuth": bool,
+ "encryption": {
+ "keySource": "Microsoft.KeyVault",
+ "keyVaultProperties": [
+ {
+ "identity": {"userAssignedIdentity": "str"},
+ "keyName": "str",
+ "keyVaultUri": "str",
+ "keyVersion": "str",
+ }
+ ],
+ "requireInfrastructureEncryption": bool,
+ },
+ "id": "str",
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "isAutoInflateEnabled": bool,
+ "kafkaEnabled": bool,
+ "location": "str",
+ "maximumThroughputUnits": 0,
+ "metricId": "str",
+ "minimumTlsVersion": "str",
+ "name": "str",
+ "privateEndpointConnections": [
+ {
+ "id": "str",
+ "location": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {"description": "str", "status": "str"},
+ "provisioningState": "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",
+ }
+ ],
+ "provisioningState": "str",
+ "publicNetworkAccess": "Enabled",
+ "serviceBusEndpoint": "str",
+ "sku": {"name": "str", "capacity": 0, "tier": "str"},
+ "status": "str",
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "tags": {"str": "str"},
+ "type": "str",
+ "updatedAt": "2020-02-20 00:00:00",
+ "zoneRedundant": bool,
+ },
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -113,11 +225,66 @@ def test_update(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_list_authorization_rules(self, resource_group):
+ def test_namespaces_create_or_update_network_rule_set(self, resource_group):
+ response = self.client.namespaces.create_or_update_network_rule_set(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ parameters={
+ "defaultAction": "str",
+ "id": "str",
+ "ipRules": [{"action": "str", "ipMask": "str"}],
+ "location": "str",
+ "name": "str",
+ "publicNetworkAccess": "Enabled",
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "trustedServiceAccessEnabled": bool,
+ "type": "str",
+ "virtualNetworkRules": [{"ignoreMissingVnetServiceEndpoint": bool, "subnet": {"id": "str"}}],
+ },
+ api_version="2024-01-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespaces_get_network_rule_set(self, resource_group):
+ response = self.client.namespaces.get_network_rule_set(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-01-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespaces_list_network_rule_set(self, resource_group):
+ response = self.client.namespaces.list_network_rule_set(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-01-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespaces_list_authorization_rules(self, resource_group):
response = self.client.namespaces.list_authorization_rules(
resource_group_name=resource_group.name,
namespace_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
result = [r for r in response]
# please add some check logic here by yourself
@@ -125,13 +292,27 @@ def test_list_authorization_rules(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_create_or_update_authorization_rule(self, resource_group):
+ def test_namespaces_create_or_update_authorization_rule(self, resource_group):
response = self.client.namespaces.create_or_update_authorization_rule(
resource_group_name=resource_group.name,
namespace_name="str",
authorization_rule_name="str",
- parameters={"location": "str", "name": "str", "rights": ["str"]},
- api_version="2015-08-01",
+ parameters={
+ "id": "str",
+ "location": "str",
+ "name": "str",
+ "rights": ["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="2024-01-01",
)
# please add some check logic here by yourself
@@ -139,12 +320,12 @@ def test_create_or_update_authorization_rule(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_delete_authorization_rule(self, resource_group):
+ def test_namespaces_delete_authorization_rule(self, resource_group):
response = self.client.namespaces.delete_authorization_rule(
resource_group_name=resource_group.name,
namespace_name="str",
authorization_rule_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -152,12 +333,12 @@ def test_delete_authorization_rule(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_get_authorization_rule(self, resource_group):
+ def test_namespaces_get_authorization_rule(self, resource_group):
response = self.client.namespaces.get_authorization_rule(
resource_group_name=resource_group.name,
namespace_name="str",
authorization_rule_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -165,12 +346,12 @@ def test_get_authorization_rule(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_list_keys(self, resource_group):
+ def test_namespaces_list_keys(self, resource_group):
response = self.client.namespaces.list_keys(
resource_group_name=resource_group.name,
namespace_name="str",
authorization_rule_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -178,13 +359,24 @@ def test_list_keys(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_regenerate_keys(self, resource_group):
+ def test_namespaces_regenerate_keys(self, resource_group):
response = self.client.namespaces.regenerate_keys(
resource_group_name=resource_group.name,
namespace_name="str",
authorization_rule_name="str",
- parameters={"policykey": "str"},
- api_version="2015-08-01",
+ parameters={"keyType": "str", "key": "str"},
+ api_version="2024-01-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespaces_check_name_availability(self, resource_group):
+ response = self.client.namespaces.check_name_availability(
+ parameters={"name": "str"},
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_namespaces_operations_async.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_namespaces_operations_async.py
index ea225cd0673ac..8351b86e77e33 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_namespaces_operations_async.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_namespaces_operations_async.py
@@ -21,20 +21,9 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_check_name_availability(self, resource_group):
- response = await self.client.namespaces.check_name_availability(
- parameters={"name": "str"},
- api_version="2015-08-01",
- )
-
- # please add some check logic here by yourself
- # ...
-
- @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
- @recorded_by_proxy_async
- async def test_list_by_subscription(self, resource_group):
- response = self.client.namespaces.list_by_subscription(
- api_version="2015-08-01",
+ async def test_namespaces_list(self, resource_group):
+ response = self.client.namespaces.list(
+ api_version="2024-01-01",
)
result = [r async for r in response]
# please add some check logic here by yourself
@@ -42,10 +31,10 @@ async def test_list_by_subscription(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_list_by_resource_group(self, resource_group):
+ async def test_namespaces_list_by_resource_group(self, resource_group):
response = self.client.namespaces.list_by_resource_group(
resource_group_name=resource_group.name,
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
result = [r async for r in response]
# please add some check logic here by yourself
@@ -53,24 +42,80 @@ async def test_list_by_resource_group(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_begin_create_or_update(self, resource_group):
+ async def test_namespaces_begin_create_or_update(self, resource_group):
response = await (
await self.client.namespaces.begin_create_or_update(
resource_group_name=resource_group.name,
namespace_name="str",
parameters={
- "location": "str",
+ "alternateName": "str",
+ "clusterArmId": "str",
"createdAt": "2020-02-20 00:00:00",
- "enabled": bool,
+ "disableLocalAuth": bool,
+ "encryption": {
+ "keySource": "Microsoft.KeyVault",
+ "keyVaultProperties": [
+ {
+ "identity": {"userAssignedIdentity": "str"},
+ "keyName": "str",
+ "keyVaultUri": "str",
+ "keyVersion": "str",
+ }
+ ],
+ "requireInfrastructureEncryption": bool,
+ },
+ "id": "str",
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "isAutoInflateEnabled": bool,
+ "kafkaEnabled": bool,
+ "location": "str",
+ "maximumThroughputUnits": 0,
"metricId": "str",
+ "minimumTlsVersion": "str",
+ "name": "str",
+ "privateEndpointConnections": [
+ {
+ "id": "str",
+ "location": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {"description": "str", "status": "str"},
+ "provisioningState": "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",
+ }
+ ],
"provisioningState": "str",
+ "publicNetworkAccess": "Enabled",
"serviceBusEndpoint": "str",
- "sku": {"tier": "str", "capacity": 0, "name": "str"},
+ "sku": {"name": "str", "capacity": 0, "tier": "str"},
"status": "str",
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
"tags": {"str": "str"},
+ "type": "str",
"updatedAt": "2020-02-20 00:00:00",
+ "zoneRedundant": bool,
},
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
).result() # call '.result()' to poll until service return final result
@@ -79,12 +124,12 @@ async def test_begin_create_or_update(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_begin_delete(self, resource_group):
+ async def test_namespaces_begin_delete(self, resource_group):
response = await (
await self.client.namespaces.begin_delete(
resource_group_name=resource_group.name,
namespace_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
).result() # call '.result()' to poll until service return final result
@@ -93,11 +138,11 @@ async def test_begin_delete(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_get(self, resource_group):
+ async def test_namespaces_get(self, resource_group):
response = await self.client.namespaces.get(
resource_group_name=resource_group.name,
namespace_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -105,12 +150,110 @@ async def test_get(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_update(self, resource_group):
+ async def test_namespaces_update(self, resource_group):
response = await self.client.namespaces.update(
resource_group_name=resource_group.name,
namespace_name="str",
- parameters={"sku": {"tier": "str", "capacity": 0, "name": "str"}, "tags": {"str": "str"}},
- api_version="2015-08-01",
+ parameters={
+ "alternateName": "str",
+ "clusterArmId": "str",
+ "createdAt": "2020-02-20 00:00:00",
+ "disableLocalAuth": bool,
+ "encryption": {
+ "keySource": "Microsoft.KeyVault",
+ "keyVaultProperties": [
+ {
+ "identity": {"userAssignedIdentity": "str"},
+ "keyName": "str",
+ "keyVaultUri": "str",
+ "keyVersion": "str",
+ }
+ ],
+ "requireInfrastructureEncryption": bool,
+ },
+ "id": "str",
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "isAutoInflateEnabled": bool,
+ "kafkaEnabled": bool,
+ "location": "str",
+ "maximumThroughputUnits": 0,
+ "metricId": "str",
+ "minimumTlsVersion": "str",
+ "name": "str",
+ "privateEndpointConnections": [
+ {
+ "id": "str",
+ "location": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {"description": "str", "status": "str"},
+ "provisioningState": "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",
+ }
+ ],
+ "provisioningState": "str",
+ "publicNetworkAccess": "Enabled",
+ "serviceBusEndpoint": "str",
+ "sku": {"name": "str", "capacity": 0, "tier": "str"},
+ "status": "str",
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "tags": {"str": "str"},
+ "type": "str",
+ "updatedAt": "2020-02-20 00:00:00",
+ "zoneRedundant": bool,
+ },
+ api_version="2024-01-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_namespaces_create_or_update_network_rule_set(self, resource_group):
+ response = await self.client.namespaces.create_or_update_network_rule_set(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ parameters={
+ "defaultAction": "str",
+ "id": "str",
+ "ipRules": [{"action": "str", "ipMask": "str"}],
+ "location": "str",
+ "name": "str",
+ "publicNetworkAccess": "Enabled",
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "trustedServiceAccessEnabled": bool,
+ "type": "str",
+ "virtualNetworkRules": [{"ignoreMissingVnetServiceEndpoint": bool, "subnet": {"id": "str"}}],
+ },
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -118,11 +261,35 @@ async def test_update(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_list_authorization_rules(self, resource_group):
+ async def test_namespaces_get_network_rule_set(self, resource_group):
+ response = await self.client.namespaces.get_network_rule_set(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-01-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_namespaces_list_network_rule_set(self, resource_group):
+ response = await self.client.namespaces.list_network_rule_set(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-01-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_namespaces_list_authorization_rules(self, resource_group):
response = self.client.namespaces.list_authorization_rules(
resource_group_name=resource_group.name,
namespace_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
result = [r async for r in response]
# please add some check logic here by yourself
@@ -130,13 +297,27 @@ async def test_list_authorization_rules(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_create_or_update_authorization_rule(self, resource_group):
+ async def test_namespaces_create_or_update_authorization_rule(self, resource_group):
response = await self.client.namespaces.create_or_update_authorization_rule(
resource_group_name=resource_group.name,
namespace_name="str",
authorization_rule_name="str",
- parameters={"location": "str", "name": "str", "rights": ["str"]},
- api_version="2015-08-01",
+ parameters={
+ "id": "str",
+ "location": "str",
+ "name": "str",
+ "rights": ["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="2024-01-01",
)
# please add some check logic here by yourself
@@ -144,12 +325,12 @@ async def test_create_or_update_authorization_rule(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_delete_authorization_rule(self, resource_group):
+ async def test_namespaces_delete_authorization_rule(self, resource_group):
response = await self.client.namespaces.delete_authorization_rule(
resource_group_name=resource_group.name,
namespace_name="str",
authorization_rule_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -157,12 +338,12 @@ async def test_delete_authorization_rule(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_get_authorization_rule(self, resource_group):
+ async def test_namespaces_get_authorization_rule(self, resource_group):
response = await self.client.namespaces.get_authorization_rule(
resource_group_name=resource_group.name,
namespace_name="str",
authorization_rule_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -170,12 +351,12 @@ async def test_get_authorization_rule(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_list_keys(self, resource_group):
+ async def test_namespaces_list_keys(self, resource_group):
response = await self.client.namespaces.list_keys(
resource_group_name=resource_group.name,
namespace_name="str",
authorization_rule_name="str",
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -183,13 +364,24 @@ async def test_list_keys(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_regenerate_keys(self, resource_group):
+ async def test_namespaces_regenerate_keys(self, resource_group):
response = await self.client.namespaces.regenerate_keys(
resource_group_name=resource_group.name,
namespace_name="str",
authorization_rule_name="str",
- parameters={"policykey": "str"},
- api_version="2015-08-01",
+ parameters={"keyType": "str", "key": "str"},
+ api_version="2024-01-01",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_namespaces_check_name_availability(self, resource_group):
+ response = await self.client.namespaces.check_name_availability(
+ parameters={"name": "str"},
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_network_security_perimeter_configuration_operations.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_network_security_perimeter_configuration_operations.py
index 8cb5677c1c793..4f73b2966f576 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_network_security_perimeter_configuration_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_network_security_perimeter_configuration_operations.py
@@ -20,11 +20,11 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_list(self, resource_group):
+ def test_network_security_perimeter_configuration_list(self, resource_group):
response = self.client.network_security_perimeter_configuration.list(
resource_group_name=resource_group.name,
namespace_name="str",
- api_version="2022-10-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_network_security_perimeter_configuration_operations_async.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_network_security_perimeter_configuration_operations_async.py
index ded9d4fafa886..3edc3023e2c29 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_network_security_perimeter_configuration_operations_async.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_network_security_perimeter_configuration_operations_async.py
@@ -21,11 +21,11 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_list(self, resource_group):
+ async def test_network_security_perimeter_configuration_list(self, resource_group):
response = await self.client.network_security_perimeter_configuration.list(
resource_group_name=resource_group.name,
namespace_name="str",
- api_version="2022-10-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_network_security_perimeter_configurations_operations.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_network_security_perimeter_configurations_operations.py
index 7874733f38918..1b9abc156cad3 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_network_security_perimeter_configurations_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_network_security_perimeter_configurations_operations.py
@@ -20,12 +20,12 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_begin_create_or_update(self, resource_group):
+ def test_network_security_perimeter_configurations_begin_create_or_update(self, resource_group):
response = self.client.network_security_perimeter_configurations.begin_create_or_update(
resource_group_name=resource_group.name,
namespace_name="str",
resource_association_name="str",
- api_version="2022-10-01-preview",
+ api_version="2024-01-01",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_network_security_perimeter_configurations_operations_async.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_network_security_perimeter_configurations_operations_async.py
index cded9c4f1afe4..17e11419a72f7 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_network_security_perimeter_configurations_operations_async.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_network_security_perimeter_configurations_operations_async.py
@@ -21,13 +21,13 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_begin_create_or_update(self, resource_group):
+ async def test_network_security_perimeter_configurations_begin_create_or_update(self, resource_group):
response = await (
await self.client.network_security_perimeter_configurations.begin_create_or_update(
resource_group_name=resource_group.name,
namespace_name="str",
resource_association_name="str",
- api_version="2022-10-01-preview",
+ api_version="2024-01-01",
)
).result() # call '.result()' to poll until service return final result
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_operations.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_operations.py
index f83ff3f32a023..70e992f0497d8 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_operations.py
@@ -20,9 +20,9 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_list(self, resource_group):
+ def test_operations_list(self, resource_group):
response = self.client.operations.list(
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
result = [r for r in response]
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_operations_async.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_operations_async.py
index b5e3cb8205c92..0faf9fec3701a 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_operations_async.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_operations_async.py
@@ -21,9 +21,9 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_list(self, resource_group):
+ async def test_operations_list(self, resource_group):
response = self.client.operations.list(
- api_version="2015-08-01",
+ api_version="2024-01-01",
)
result = [r async for r in response]
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_private_endpoint_connections_operations.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_private_endpoint_connections_operations.py
index f1dc09c973a8f..85fea940c18e6 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_private_endpoint_connections_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_private_endpoint_connections_operations.py
@@ -20,11 +20,11 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_list(self, resource_group):
+ def test_private_endpoint_connections_list(self, resource_group):
response = self.client.private_endpoint_connections.list(
resource_group_name=resource_group.name,
namespace_name="str",
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
result = [r for r in response]
# please add some check logic here by yourself
@@ -32,20 +32,29 @@ def test_list(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_create_or_update(self, resource_group):
+ def test_private_endpoint_connections_create_or_update(self, resource_group):
response = self.client.private_endpoint_connections.create_or_update(
resource_group_name=resource_group.name,
namespace_name="str",
private_endpoint_connection_name="str",
parameters={
"id": "str",
+ "location": "str",
"name": "str",
"privateEndpoint": {"id": "str"},
"privateLinkServiceConnectionState": {"description": "str", "status": "str"},
"provisioningState": "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="2018-01-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -53,12 +62,12 @@ def test_create_or_update(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_begin_delete(self, resource_group):
+ def test_private_endpoint_connections_begin_delete(self, resource_group):
response = self.client.private_endpoint_connections.begin_delete(
resource_group_name=resource_group.name,
namespace_name="str",
private_endpoint_connection_name="str",
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
).result() # call '.result()' to poll until service return final result
# please add some check logic here by yourself
@@ -66,12 +75,12 @@ def test_begin_delete(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_get(self, resource_group):
+ def test_private_endpoint_connections_get(self, resource_group):
response = self.client.private_endpoint_connections.get(
resource_group_name=resource_group.name,
namespace_name="str",
private_endpoint_connection_name="str",
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_private_endpoint_connections_operations_async.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_private_endpoint_connections_operations_async.py
index c2099ba733716..75f2d334f173c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_private_endpoint_connections_operations_async.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_private_endpoint_connections_operations_async.py
@@ -21,11 +21,11 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_list(self, resource_group):
+ async def test_private_endpoint_connections_list(self, resource_group):
response = self.client.private_endpoint_connections.list(
resource_group_name=resource_group.name,
namespace_name="str",
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
result = [r async for r in response]
# please add some check logic here by yourself
@@ -33,20 +33,29 @@ async def test_list(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_create_or_update(self, resource_group):
+ async def test_private_endpoint_connections_create_or_update(self, resource_group):
response = await self.client.private_endpoint_connections.create_or_update(
resource_group_name=resource_group.name,
namespace_name="str",
private_endpoint_connection_name="str",
parameters={
"id": "str",
+ "location": "str",
"name": "str",
"privateEndpoint": {"id": "str"},
"privateLinkServiceConnectionState": {"description": "str", "status": "str"},
"provisioningState": "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="2018-01-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -54,13 +63,13 @@ async def test_create_or_update(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_begin_delete(self, resource_group):
+ async def test_private_endpoint_connections_begin_delete(self, resource_group):
response = await (
await self.client.private_endpoint_connections.begin_delete(
resource_group_name=resource_group.name,
namespace_name="str",
private_endpoint_connection_name="str",
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
).result() # call '.result()' to poll until service return final result
@@ -69,12 +78,12 @@ async def test_begin_delete(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_get(self, resource_group):
+ async def test_private_endpoint_connections_get(self, resource_group):
response = await self.client.private_endpoint_connections.get(
resource_group_name=resource_group.name,
namespace_name="str",
private_endpoint_connection_name="str",
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_private_link_resources_operations.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_private_link_resources_operations.py
index f9d7c425f547f..b6509bb759557 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_private_link_resources_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_private_link_resources_operations.py
@@ -20,11 +20,11 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_get(self, resource_group):
+ def test_private_link_resources_get(self, resource_group):
response = self.client.private_link_resources.get(
resource_group_name=resource_group.name,
namespace_name="str",
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_private_link_resources_operations_async.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_private_link_resources_operations_async.py
index 69155c8d39ee7..c8d39191ca209 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_private_link_resources_operations_async.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_private_link_resources_operations_async.py
@@ -21,11 +21,11 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_get(self, resource_group):
+ async def test_private_link_resources_get(self, resource_group):
response = await self.client.private_link_resources.get(
resource_group_name=resource_group.name,
namespace_name="str",
- api_version="2018-01-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_schema_registry_operations.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_schema_registry_operations.py
index f8e89ad3a0ea0..95a24e4ed419c 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_schema_registry_operations.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_schema_registry_operations.py
@@ -20,11 +20,11 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_list_by_namespace(self, resource_group):
+ def test_schema_registry_list_by_namespace(self, resource_group):
response = self.client.schema_registry.list_by_namespace(
resource_group_name=resource_group.name,
namespace_name="str",
- api_version="2022-10-01-preview",
+ api_version="2024-01-01",
)
result = [r for r in response]
# please add some check logic here by yourself
@@ -32,7 +32,7 @@ def test_list_by_namespace(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_create_or_update(self, resource_group):
+ def test_schema_registry_create_or_update(self, resource_group):
response = self.client.schema_registry.create_or_update(
resource_group_name=resource_group.name,
namespace_name="str",
@@ -57,7 +57,7 @@ def test_create_or_update(self, resource_group):
"type": "str",
"updatedAtUtc": "2020-02-20 00:00:00",
},
- api_version="2022-10-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -65,12 +65,12 @@ def test_create_or_update(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_delete(self, resource_group):
+ def test_schema_registry_delete(self, resource_group):
response = self.client.schema_registry.delete(
resource_group_name=resource_group.name,
namespace_name="str",
schema_group_name="str",
- api_version="2022-10-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -78,12 +78,12 @@ def test_delete(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy
- def test_get(self, resource_group):
+ def test_schema_registry_get(self, resource_group):
response = self.client.schema_registry.get(
resource_group_name=resource_group.name,
namespace_name="str",
schema_group_name="str",
- api_version="2022-10-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
diff --git a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_schema_registry_operations_async.py b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_schema_registry_operations_async.py
index 8404fcf6401c2..b0ceca6f38a33 100644
--- a/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_schema_registry_operations_async.py
+++ b/sdk/eventhub/azure-mgmt-eventhub/generated_tests/test_event_hub_management_schema_registry_operations_async.py
@@ -21,11 +21,11 @@ def setup_method(self, method):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_list_by_namespace(self, resource_group):
+ async def test_schema_registry_list_by_namespace(self, resource_group):
response = self.client.schema_registry.list_by_namespace(
resource_group_name=resource_group.name,
namespace_name="str",
- api_version="2022-10-01-preview",
+ api_version="2024-01-01",
)
result = [r async for r in response]
# please add some check logic here by yourself
@@ -33,7 +33,7 @@ async def test_list_by_namespace(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_create_or_update(self, resource_group):
+ async def test_schema_registry_create_or_update(self, resource_group):
response = await self.client.schema_registry.create_or_update(
resource_group_name=resource_group.name,
namespace_name="str",
@@ -58,7 +58,7 @@ async def test_create_or_update(self, resource_group):
"type": "str",
"updatedAtUtc": "2020-02-20 00:00:00",
},
- api_version="2022-10-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -66,12 +66,12 @@ async def test_create_or_update(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_delete(self, resource_group):
+ async def test_schema_registry_delete(self, resource_group):
response = await self.client.schema_registry.delete(
resource_group_name=resource_group.name,
namespace_name="str",
schema_group_name="str",
- api_version="2022-10-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself
@@ -79,12 +79,12 @@ async def test_delete(self, resource_group):
@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
@recorded_by_proxy_async
- async def test_get(self, resource_group):
+ async def test_schema_registry_get(self, resource_group):
response = await self.client.schema_registry.get(
resource_group_name=resource_group.name,
namespace_name="str",
schema_group_name="str",
- api_version="2022-10-01-preview",
+ api_version="2024-01-01",
)
# please add some check logic here by yourself