diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/_meta.json b/sdk/eventgrid/azure-mgmt-eventgrid/_meta.json
index 9726eeb3861e..ff6275eb7443 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/_meta.json
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/_meta.json
@@ -1,11 +1,11 @@
{
- "commit": "edbae6fb086224abd5b744edc7b833fec0909617",
- "repository_url": "https://github.com/Azure/azure-rest-api-specs",
- "autorest": "3.9.7",
+ "commit": "ac25e876360fd307a78193b046042064e76e2683",
+ "repository_url": "https://github.com/test-repo-billy/azure-rest-api-specs",
+ "autorest": "3.10.2",
"use": [
- "@autorest/python@6.13.7",
+ "@autorest/python@6.27.4",
"@autorest/modelerfour@4.27.0"
],
- "autorest_command": "autorest specification/eventgrid/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --version-tolerant=False",
+ "autorest_command": "autorest specification/eventgrid/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/eventgrid/resource-manager/readme.md"
}
\ No newline at end of file
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/__init__.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/__init__.py
index bd25a9879ad1..753223bb7588 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/__init__.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/__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_grid_management_client import EventGridManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._event_grid_management_client import EventGridManagementClient # 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__ = [
"EventGridManagementClient",
]
-__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/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_configuration.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_configuration.py
index 979790446589..97ad426f3f8b 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_configuration.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_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 EventGridManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+class EventGridManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for EventGridManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -29,13 +28,13 @@ class EventGridManagementClientConfiguration: # pylint: disable=too-many-instan
:param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure
subscription. The subscription ID forms part of the URI for every service call. Required.
:type subscription_id: str
- :keyword api_version: Api Version. Default value is "2024-06-01-preview". Note that overriding
+ :keyword api_version: Api Version. Default value is "2024-12-15-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
- api_version: str = kwargs.pop("api_version", "2024-06-01-preview")
+ api_version: str = kwargs.pop("api_version", "2024-12-15-preview")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_event_grid_management_client.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_event_grid_management_client.py
index dc71fdeb2bc2..0b28fa10c1cd 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_event_grid_management_client.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_event_grid_management_client.py
@@ -8,6 +8,7 @@
from copy import deepcopy
from typing import Any, TYPE_CHECKING
+from typing_extensions import Self
from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
@@ -52,12 +53,11 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
-class EventGridManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
- """Azure EventGrid Management Client.
+class EventGridManagementClient: # pylint: disable=too-many-instance-attributes
+ """Azure EventGrid Management Client test.
:ivar ca_certificates: CaCertificatesOperations operations
:vartype ca_certificates: azure.mgmt.eventgrid.operations.CaCertificatesOperations
@@ -139,7 +139,7 @@ class EventGridManagementClient: # pylint: disable=client-accepts-api-version-k
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
- :keyword api_version: Api Version. Default value is "2024-06-01-preview". Note that overriding
+ :keyword api_version: Api Version. Default value is "2024-12-15-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
@@ -273,7 +273,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
def close(self) -> None:
self._client.close()
- def __enter__(self) -> "EventGridManagementClient":
+ def __enter__(self) -> Self:
self._client.__enter__()
return self
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_patch.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_patch.py
index f99e77fef986..17dbc073e01b 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_patch.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_patch.py
@@ -25,6 +25,7 @@
#
# --------------------------------------------------------------------------
+
# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_serialization.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_serialization.py
index 2f781d740827..b24ab2885450 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_serialization.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_serialization.py
@@ -1,3 +1,4 @@
+# pylint: disable=too-many-lines
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -24,7 +25,6 @@
#
# --------------------------------------------------------------------------
-# pylint: skip-file
# pyright: reportUnnecessaryTypeIgnoreComment=false
from base64 import b64decode, b64encode
@@ -52,7 +52,6 @@
MutableMapping,
Type,
List,
- Mapping,
)
try:
@@ -91,6 +90,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 +113,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type:
try:
return json.loads(data_as_str)
except ValueError as err:
- raise DeserializationError("JSON is invalid: {}".format(err), err)
+ raise DeserializationError("JSON is invalid: {}".format(err), err) from err
elif "xml" in (content_type or []):
try:
@@ -144,6 +145,8 @@ def _json_attemp(data):
# context otherwise.
_LOGGER.critical("Wasn't XML not JSON, failing")
raise DeserializationError("XML is invalid") from err
+ elif content_type.startswith("text/"):
+ return data_as_str
raise DeserializationError("Cannot deserialize content-type: {}".format(content_type))
@classmethod
@@ -153,6 +156,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]],
Use bytes and headers to NOT use any requests/aiohttp or whatever
specific implementation.
Headers will tested for "content-type"
+
+ :param bytes body_bytes: The body of the response.
+ :param dict headers: The headers of the response.
+ :returns: The deserialized data.
+ :rtype: object
"""
# Try to use content-type from headers if available
content_type = None
@@ -182,15 +190,30 @@ class UTC(datetime.tzinfo):
"""Time Zone info for handling UTC"""
def utcoffset(self, dt):
- """UTF offset for UTC is 0."""
+ """UTF offset for UTC is 0.
+
+ :param datetime.datetime dt: The datetime
+ :returns: The offset
+ :rtype: datetime.timedelta
+ """
return datetime.timedelta(0)
def tzname(self, dt):
- """Timestamp representation."""
+ """Timestamp representation.
+
+ :param datetime.datetime dt: The datetime
+ :returns: The timestamp representation
+ :rtype: str
+ """
return "Z"
def dst(self, dt):
- """No daylight saving for UTC."""
+ """No daylight saving for UTC.
+
+ :param datetime.datetime dt: The datetime
+ :returns: The daylight saving time
+ :rtype: datetime.timedelta
+ """
return datetime.timedelta(hours=1)
@@ -204,7 +227,7 @@ class _FixedOffset(datetime.tzinfo): # type: ignore
:param datetime.timedelta offset: offset in timedelta format
"""
- def __init__(self, offset):
+ def __init__(self, offset) -> None:
self.__offset = offset
def utcoffset(self, dt):
@@ -233,24 +256,26 @@ def __getinitargs__(self):
_FLATTEN = re.compile(r"(? None:
self.additional_properties: Optional[Dict[str, Any]] = {}
- for k in kwargs:
+ for k in kwargs: # pylint: disable=consider-using-dict-items
if k not in self._attribute_map:
_LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__)
elif k in self._validation and self._validation[k].get("readonly", False):
@@ -298,13 +330,23 @@ def __init__(self, **kwargs: Any) -> None:
setattr(self, k, kwargs[k])
def __eq__(self, other: Any) -> bool:
- """Compare objects by comparing all attributes."""
+ """Compare objects by comparing all attributes.
+
+ :param object other: The object to compare
+ :returns: True if objects are equal
+ :rtype: bool
+ """
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
return False
def __ne__(self, other: Any) -> bool:
- """Compare objects by comparing all attributes."""
+ """Compare objects by comparing all attributes.
+
+ :param object other: The object to compare
+ :returns: True if objects are not equal
+ :rtype: bool
+ """
return not self.__eq__(other)
def __str__(self) -> str:
@@ -324,7 +366,11 @@ def is_xml_model(cls) -> bool:
@classmethod
def _create_xml_node(cls):
- """Create XML node."""
+ """Create XML node.
+
+ :returns: The XML node
+ :rtype: xml.etree.ElementTree.Element
+ """
try:
xml_map = cls._xml_map # type: ignore
except AttributeError:
@@ -344,7 +390,9 @@ 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,
@@ -378,12 +426,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):
@@ -393,7 +444,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
@@ -406,6 +457,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
@@ -424,9 +476,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
@@ -446,21 +500,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:
@@ -499,11 +557,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"}
@@ -538,7 +598,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,
@@ -558,13 +618,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)
@@ -590,12 +653,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"] == "":
@@ -631,7 +696,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
@@ -662,17 +728,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
@@ -701,7 +767,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
@@ -710,9 +776,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
"""
@@ -726,21 +794,20 @@ 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
@@ -757,19 +824,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]"]:
@@ -778,21 +846,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")
@@ -803,7 +870,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
@@ -819,11 +886,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
@@ -839,23 +905,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
@@ -869,8 +938,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.
@@ -880,15 +948,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.")
@@ -943,9 +1009,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 = {}
@@ -969,7 +1034,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
@@ -977,6 +1042,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
@@ -1001,7 +1067,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:
@@ -1032,56 +1098,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)
@@ -1089,11 +1160,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)
@@ -1103,30 +1175,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],
@@ -1139,12 +1213,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)
@@ -1170,13 +1245,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
@@ -1184,11 +1260,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
@@ -1209,7 +1285,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
@@ -1230,17 +1308,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)
@@ -1277,7 +1367,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
@@ -1329,22 +1419,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:
@@ -1352,7 +1441,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.
@@ -1361,9 +1450,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,
@@ -1401,11 +1490,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
@@ -1414,12 +1504,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)
@@ -1438,13 +1529,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:
+ 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"...
@@ -1474,9 +1565,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:
@@ -1503,6 +1593,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
@@ -1514,7 +1606,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
@@ -1529,10 +1621,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
)
@@ -1550,10 +1644,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", {})
@@ -1577,24 +1673,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():
@@ -1603,15 +1710,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
@@ -1625,7 +1733,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)
@@ -1645,14 +1757,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:
@@ -1669,6 +1781,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):
@@ -1679,11 +1792,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.
"""
@@ -1718,11 +1832,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
@@ -1730,6 +1843,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.
"""
@@ -1741,24 +1855,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):
@@ -1766,6 +1879,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,
@@ -1779,8 +1893,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):
@@ -1792,6 +1905,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:
@@ -1802,9 +1916,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:
@@ -1820,6 +1934,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.
"""
@@ -1832,6 +1947,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.
"""
@@ -1847,8 +1963,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
@@ -1863,6 +1980,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.
"""
@@ -1875,6 +1993,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.
"""
@@ -1885,14 +2004,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.
"""
@@ -1908,6 +2027,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.
"""
@@ -1922,6 +2042,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.
"""
@@ -1937,14 +2058,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.
"""
@@ -1974,8 +2095,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):
@@ -1983,6 +2103,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
"""
@@ -1994,5 +2115,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/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_vendor.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_vendor.py
deleted file mode 100644
index 0dafe0e287ff..000000000000
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_vendor.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# --------------------------------------------------------------------------
-# Copyright (c) Microsoft Corporation. All rights reserved.
-# Licensed under the MIT License. See License.txt in the project root for license information.
-# Code generated by Microsoft (R) AutoRest Code Generator.
-# Changes may cause incorrect behavior and will be lost if the code is regenerated.
-# --------------------------------------------------------------------------
-
-from azure.core.pipeline.transport import HttpRequest
-
-
-def _convert_request(request, files=None):
- data = request.content if not files else None
- request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
- if files:
- request.set_formdata_body(files)
- return request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_version.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_version.py
index 95930dfec748..f30401ec2040 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_version.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_version.py
@@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-VERSION = "10.3.0b4"
+VERSION = "2.2.0"
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/__init__.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/__init__.py
index a5837ab3e4e4..aa70b183c0f3 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/__init__.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/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_grid_management_client import EventGridManagementClient
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._event_grid_management_client import EventGridManagementClient # 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__ = [
"EventGridManagementClient",
]
-__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/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_configuration.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_configuration.py
index 8193e78ba029..85b0d5f6530f 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_configuration.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/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 EventGridManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
+class EventGridManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for EventGridManagementClient.
Note that all parameters used to create this instance are saved as instance
@@ -29,13 +28,13 @@ class EventGridManagementClientConfiguration: # pylint: disable=too-many-instan
:param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure
subscription. The subscription ID forms part of the URI for every service call. Required.
:type subscription_id: str
- :keyword api_version: Api Version. Default value is "2024-06-01-preview". Note that overriding
+ :keyword api_version: Api Version. Default value is "2024-12-15-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
- api_version: str = kwargs.pop("api_version", "2024-06-01-preview")
+ api_version: str = kwargs.pop("api_version", "2024-12-15-preview")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_event_grid_management_client.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_event_grid_management_client.py
index 61cf9c637db6..6e4b3f814895 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_event_grid_management_client.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_event_grid_management_client.py
@@ -8,6 +8,7 @@
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
+from typing_extensions import Self
from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest
@@ -52,12 +53,11 @@
)
if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
-class EventGridManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
- """Azure EventGrid Management Client.
+class EventGridManagementClient: # pylint: disable=too-many-instance-attributes
+ """Azure EventGrid Management Client test.
:ivar ca_certificates: CaCertificatesOperations operations
:vartype ca_certificates: azure.mgmt.eventgrid.aio.operations.CaCertificatesOperations
@@ -142,7 +142,7 @@ class EventGridManagementClient: # pylint: disable=client-accepts-api-version-k
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
- :keyword api_version: Api Version. Default value is "2024-06-01-preview". Note that overriding
+ :keyword api_version: Api Version. Default value is "2024-12-15-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
@@ -278,7 +278,7 @@ def _send_request(
async def close(self) -> None:
await self._client.close()
- async def __aenter__(self) -> "EventGridManagementClient":
+ async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_patch.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_patch.py
index f99e77fef986..17dbc073e01b 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_patch.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/_patch.py
@@ -25,6 +25,7 @@
#
# --------------------------------------------------------------------------
+
# This file is used for handwritten extensions to the generated code. Example:
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
def patch_sdk():
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/__init__.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/__init__.py
index a245f48233e3..9a0d2f8ebe67 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/__init__.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/__init__.py
@@ -5,41 +5,47 @@
# 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 ._ca_certificates_operations import CaCertificatesOperations
-from ._channels_operations import ChannelsOperations
-from ._client_groups_operations import ClientGroupsOperations
-from ._clients_operations import ClientsOperations
-from ._domains_operations import DomainsOperations
-from ._domain_topics_operations import DomainTopicsOperations
-from ._domain_topic_event_subscriptions_operations import DomainTopicEventSubscriptionsOperations
-from ._topic_event_subscriptions_operations import TopicEventSubscriptionsOperations
-from ._domain_event_subscriptions_operations import DomainEventSubscriptionsOperations
-from ._event_subscriptions_operations import EventSubscriptionsOperations
-from ._system_topic_event_subscriptions_operations import SystemTopicEventSubscriptionsOperations
-from ._namespace_topic_event_subscriptions_operations import NamespaceTopicEventSubscriptionsOperations
-from ._partner_topic_event_subscriptions_operations import PartnerTopicEventSubscriptionsOperations
-from ._namespaces_operations import NamespacesOperations
-from ._namespace_topics_operations import NamespaceTopicsOperations
-from ._operations import Operations
-from ._partner_configurations_operations import PartnerConfigurationsOperations
-from ._partner_destinations_operations import PartnerDestinationsOperations
-from ._partner_namespaces_operations import PartnerNamespacesOperations
-from ._partner_registrations_operations import PartnerRegistrationsOperations
-from ._partner_topics_operations import PartnerTopicsOperations
-from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations
-from ._permission_bindings_operations import PermissionBindingsOperations
-from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
-from ._private_link_resources_operations import PrivateLinkResourcesOperations
-from ._system_topics_operations import SystemTopicsOperations
-from ._topics_operations import TopicsOperations
-from ._extension_topics_operations import ExtensionTopicsOperations
-from ._topic_spaces_operations import TopicSpacesOperations
-from ._topic_types_operations import TopicTypesOperations
-from ._verified_partners_operations import VerifiedPartnersOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._ca_certificates_operations import CaCertificatesOperations # type: ignore
+from ._channels_operations import ChannelsOperations # type: ignore
+from ._client_groups_operations import ClientGroupsOperations # type: ignore
+from ._clients_operations import ClientsOperations # type: ignore
+from ._domains_operations import DomainsOperations # type: ignore
+from ._domain_topics_operations import DomainTopicsOperations # type: ignore
+from ._domain_topic_event_subscriptions_operations import DomainTopicEventSubscriptionsOperations # type: ignore
+from ._topic_event_subscriptions_operations import TopicEventSubscriptionsOperations # type: ignore
+from ._domain_event_subscriptions_operations import DomainEventSubscriptionsOperations # type: ignore
+from ._event_subscriptions_operations import EventSubscriptionsOperations # type: ignore
+from ._system_topic_event_subscriptions_operations import SystemTopicEventSubscriptionsOperations # type: ignore
+from ._namespace_topic_event_subscriptions_operations import NamespaceTopicEventSubscriptionsOperations # type: ignore
+from ._partner_topic_event_subscriptions_operations import PartnerTopicEventSubscriptionsOperations # type: ignore
+from ._namespaces_operations import NamespacesOperations # type: ignore
+from ._namespace_topics_operations import NamespaceTopicsOperations # type: ignore
+from ._operations import Operations # type: ignore
+from ._partner_configurations_operations import PartnerConfigurationsOperations # type: ignore
+from ._partner_destinations_operations import PartnerDestinationsOperations # type: ignore
+from ._partner_namespaces_operations import PartnerNamespacesOperations # type: ignore
+from ._partner_registrations_operations import PartnerRegistrationsOperations # type: ignore
+from ._partner_topics_operations import PartnerTopicsOperations # type: ignore
+from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore
+from ._permission_bindings_operations import PermissionBindingsOperations # type: ignore
+from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore
+from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore
+from ._system_topics_operations import SystemTopicsOperations # type: ignore
+from ._topics_operations import TopicsOperations # type: ignore
+from ._extension_topics_operations import ExtensionTopicsOperations # type: ignore
+from ._topic_spaces_operations import TopicSpacesOperations # type: ignore
+from ._topic_types_operations import TopicTypesOperations # type: ignore
+from ._verified_partners_operations import VerifiedPartnersOperations # 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__ = [
@@ -75,5 +81,5 @@
"TopicTypesOperations",
"VerifiedPartnersOperations",
]
-__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/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_ca_certificates_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_ca_certificates_operations.py
index 4bc11a2b9b74..8c1ed6565de4 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_ca_certificates_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_ca_certificates_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,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._ca_certificates_operations import (
build_create_or_update_request,
build_delete_request,
@@ -38,6 +38,10 @@
build_list_by_namespace_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -80,7 +84,7 @@ async def get(
:rtype: ~azure.mgmt.eventgrid.models.CaCertificate
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -103,7 +107,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -118,7 +121,7 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("CaCertificate", pipeline_response)
+ deserialized = self._deserialize("CaCertificate", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -132,8 +135,8 @@ async def _create_or_update_initial(
ca_certificate_name: str,
ca_certificate_info: Union[_models.CaCertificate, IO[bytes]],
**kwargs: Any
- ) -> _models.CaCertificate:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -146,7 +149,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.CaCertificate] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -168,10 +171,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -179,15 +182,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ 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 = self._deserialize("CaCertificate", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("CaCertificate", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -310,10 +313,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("CaCertificate", pipeline_response)
+ deserialized = self._deserialize("CaCertificate", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -338,10 +342,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, namespace_name: str, ca_certificate_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -353,7 +357,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -364,10 +368,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -375,6 +379,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -383,8 +391,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -414,7 +426,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
namespace_name=namespace_name,
ca_certificate_name=ca_certificate_name,
@@ -424,6 +436,7 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -487,7 +500,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CaCertificatesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -508,7 +521,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -524,7 +536,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_channels_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_channels_operations.py
index 82838ac77b25..385c251eb9c7 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_channels_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_channels_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,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._channels_operations import (
build_create_or_update_request,
build_delete_request,
@@ -40,6 +40,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -82,7 +86,7 @@ async def get(
:rtype: ~azure.mgmt.eventgrid.models.Channel
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -105,7 +109,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -119,7 +122,7 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Channel", pipeline_response)
+ deserialized = self._deserialize("Channel", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -217,7 +220,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventgrid.models.Channel
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -252,7 +255,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -266,21 +268,17 @@ async def create_or_update(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("Channel", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Channel", pipeline_response)
+ deserialized = self._deserialize("Channel", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, partner_namespace_name: str, channel_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -292,7 +290,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -303,10 +301,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -314,6 +312,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -321,8 +323,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -352,7 +358,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
partner_namespace_name=partner_namespace_name,
channel_name=channel_name,
@@ -362,6 +368,7 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -384,7 +391,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@overload
- async def update( # pylint: disable=inconsistent-return-statements
+ async def update(
self,
resource_group_name: str,
partner_namespace_name: str,
@@ -416,7 +423,7 @@ async def update( # pylint: disable=inconsistent-return-statements
"""
@overload
- async def update( # pylint: disable=inconsistent-return-statements
+ async def update(
self,
resource_group_name: str,
partner_namespace_name: str,
@@ -448,7 +455,7 @@ async def update( # pylint: disable=inconsistent-return-statements
"""
@distributed_trace_async
- async def update( # pylint: disable=inconsistent-return-statements
+ async def update(
self,
resource_group_name: str,
partner_namespace_name: str,
@@ -475,7 +482,7 @@ async def update( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -510,7 +517,6 @@ async def update( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -567,7 +573,7 @@ def list_by_partner_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ChannelsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -588,7 +594,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -604,7 +609,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -652,7 +656,7 @@ async def get_full_url(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -675,7 +679,6 @@ async def get_full_url(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -689,7 +692,7 @@ async def get_full_url(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response)
+ deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_client_groups_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_client_groups_operations.py
index 128cc0334a23..f98e9e175b30 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_client_groups_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_client_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.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._client_groups_operations import (
build_create_or_update_request,
build_delete_request,
@@ -38,6 +38,10 @@
build_list_by_namespace_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -80,7 +84,7 @@ async def get(
:rtype: ~azure.mgmt.eventgrid.models.ClientGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -103,7 +107,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -118,7 +121,7 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ClientGroup", pipeline_response)
+ deserialized = self._deserialize("ClientGroup", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -132,8 +135,8 @@ async def _create_or_update_initial(
client_group_name: str,
client_group_info: Union[_models.ClientGroup, IO[bytes]],
**kwargs: Any
- ) -> _models.ClientGroup:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -146,7 +149,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.ClientGroup] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -168,10 +171,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -179,15 +182,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ 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 = self._deserialize("ClientGroup", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ClientGroup", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -310,10 +313,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("ClientGroup", pipeline_response)
+ deserialized = self._deserialize("ClientGroup", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -338,10 +342,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, namespace_name: str, client_group_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -353,7 +357,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -364,10 +368,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -375,6 +379,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -383,8 +391,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -414,7 +426,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
namespace_name=namespace_name,
client_group_name=client_group_name,
@@ -424,6 +436,7 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -487,7 +500,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClientGroupsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -508,7 +521,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -524,7 +536,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_clients_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_clients_operations.py
index 2754378edf57..a60c6db8a985 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_clients_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_clients_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,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._clients_operations import (
build_create_or_update_request,
build_delete_request,
@@ -38,6 +38,10 @@
build_list_by_namespace_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -80,7 +84,7 @@ async def get(
:rtype: ~azure.mgmt.eventgrid.models.Client
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -103,7 +107,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -118,7 +121,7 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Client", pipeline_response)
+ deserialized = self._deserialize("Client", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -132,8 +135,8 @@ async def _create_or_update_initial(
client_name: str,
client_info: Union[_models.Client, IO[bytes]],
**kwargs: Any
- ) -> _models.Client:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -146,7 +149,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Client] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -168,10 +171,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -179,15 +182,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ 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 = self._deserialize("Client", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Client", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -309,10 +312,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Client", pipeline_response)
+ deserialized = self._deserialize("Client", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -337,10 +341,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, namespace_name: str, client_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -352,7 +356,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -363,10 +367,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -374,6 +378,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -382,8 +390,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -413,7 +425,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
namespace_name=namespace_name,
client_name=client_name,
@@ -423,6 +435,7 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -486,7 +499,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClientsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -507,7 +520,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -523,7 +535,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_event_subscriptions_operations.py
index 14851640ade5..9015ae6d82d8 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_event_subscriptions_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_event_subscriptions_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,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._domain_event_subscriptions_operations import (
build_create_or_update_request,
build_delete_request,
@@ -41,6 +41,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -83,7 +87,7 @@ async def get_delivery_attributes(
:rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -106,7 +110,6 @@ async def get_delivery_attributes(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -120,7 +123,7 @@ async def get_delivery_attributes(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response)
+ deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -146,7 +149,7 @@ async def get(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscription
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -169,7 +172,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -183,7 +185,7 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -197,8 +199,8 @@ async def _create_or_update_initial(
event_subscription_name: str,
event_subscription_info: Union[_models.EventSubscription, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -211,7 +213,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -233,10 +235,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -244,14 +246,14 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("EventSubscription", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -382,10 +384,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -407,10 +410,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, domain_name: str, event_subscription_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -422,7 +425,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -433,10 +436,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -444,6 +447,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -451,8 +458,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -482,7 +493,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
domain_name=domain_name,
event_subscription_name=event_subscription_name,
@@ -492,6 +503,7 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -520,8 +532,8 @@ async def _update_initial(
event_subscription_name: str,
event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -534,7 +546,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -556,10 +568,10 @@ async def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -567,10 +579,14 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -695,10 +711,11 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -739,7 +756,7 @@ async def get_full_url(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -762,7 +779,6 @@ async def get_full_url(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -776,7 +792,7 @@ async def get_full_url(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response)
+ deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -823,7 +839,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -844,7 +860,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -860,7 +875,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topic_event_subscriptions_operations.py
index 4e519de65afb..798d507befd4 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topic_event_subscriptions_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topic_event_subscriptions_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,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._domain_topic_event_subscriptions_operations import (
build_create_or_update_request,
build_delete_request,
@@ -41,6 +41,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -85,7 +89,7 @@ async def get_delivery_attributes(
:rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -109,7 +113,6 @@ async def get_delivery_attributes(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -123,7 +126,7 @@ async def get_delivery_attributes(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response)
+ deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -151,7 +154,7 @@ async def get(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscription
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -175,7 +178,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -189,7 +191,7 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -204,8 +206,8 @@ async def _create_or_update_initial(
event_subscription_name: str,
event_subscription_info: Union[_models.EventSubscription, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -218,7 +220,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -241,10 +243,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -252,14 +254,14 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("EventSubscription", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -400,10 +402,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -425,10 +428,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, domain_name: str, topic_name: str, event_subscription_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -440,7 +443,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -452,10 +455,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -463,6 +466,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -470,8 +477,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -503,7 +514,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
domain_name=domain_name,
topic_name=topic_name,
@@ -514,6 +525,7 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -543,8 +555,8 @@ async def _update_initial(
event_subscription_name: str,
event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -557,7 +569,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -580,10 +592,10 @@ async def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -591,10 +603,14 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -729,10 +745,11 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -775,7 +792,7 @@ async def get_full_url(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -799,7 +816,6 @@ async def get_full_url(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -813,7 +829,7 @@ async def get_full_url(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response)
+ deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -863,7 +879,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -885,7 +901,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -901,7 +916,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topics_operations.py
index 85c2d42a23a5..9058b7588dd7 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topics_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domain_topics_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,7 +5,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, TypeVar, Union, cast
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -16,12 +16,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -29,7 +30,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._domain_topics_operations import (
build_create_or_update_request,
build_delete_request,
@@ -37,6 +37,10 @@
build_list_by_domain_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -79,7 +83,7 @@ async def get(
:rtype: ~azure.mgmt.eventgrid.models.DomainTopic
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -102,7 +106,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -116,7 +119,7 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DomainTopic", pipeline_response)
+ deserialized = self._deserialize("DomainTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -125,8 +128,8 @@ async def get(
async def _create_or_update_initial(
self, resource_group_name: str, domain_name: str, domain_topic_name: str, **kwargs: Any
- ) -> _models.DomainTopic:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -138,7 +141,7 @@ async def _create_or_update_initial(
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[_models.DomainTopic] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_create_or_update_request(
resource_group_name=resource_group_name,
@@ -149,10 +152,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -160,10 +163,14 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DomainTopic", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -209,10 +216,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("DomainTopic", pipeline_response)
+ deserialized = self._deserialize("DomainTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -234,10 +242,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, domain_name: str, domain_topic_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -249,7 +257,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -260,10 +268,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -271,6 +279,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -278,8 +290,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -309,7 +325,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
domain_name=domain_name,
domain_topic_name=domain_topic_name,
@@ -319,6 +335,7 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -380,7 +397,7 @@ def list_by_domain(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DomainTopicsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -401,7 +418,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -417,7 +433,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domains_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domains_operations.py
index 434858ff84ac..fb43b0a2167f 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domains_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_domains_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +18,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +32,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._domains_operations import (
build_create_or_update_request,
build_delete_request,
@@ -42,6 +43,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -80,7 +85,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -
:rtype: ~azure.mgmt.eventgrid.models.Domain
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -102,7 +107,6 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -116,7 +120,7 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Domain", pipeline_response)
+ deserialized = self._deserialize("Domain", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -125,8 +129,8 @@ async def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -
async def _create_or_update_initial(
self, resource_group_name: str, domain_name: str, domain_info: Union[_models.Domain, IO[bytes]], **kwargs: Any
- ) -> _models.Domain:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -139,7 +143,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Domain] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -160,10 +164,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -171,10 +175,14 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Domain", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -282,10 +290,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Domain", pipeline_response)
+ deserialized = self._deserialize("Domain", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -307,10 +316,8 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, domain_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ async def _delete_initial(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -322,7 +329,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -332,10 +339,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -343,6 +350,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -350,8 +361,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> AsyncLROPoller[None]:
@@ -377,7 +392,7 @@ async def begin_delete(self, resource_group_name: str, domain_name: str, **kwarg
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
domain_name=domain_name,
api_version=api_version,
@@ -386,6 +401,7 @@ async def begin_delete(self, resource_group_name: str, domain_name: str, **kwarg
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -413,8 +429,8 @@ async def _update_initial(
domain_name: str,
domain_update_parameters: Union[_models.DomainUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.Domain]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -427,7 +443,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.Domain]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -448,10 +464,10 @@ async def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -459,12 +475,14 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 201:
- deserialized = self._deserialize("Domain", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -578,10 +596,11 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Domain", pipeline_response)
+ deserialized = self._deserialize("Domain", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -633,7 +652,7 @@ def list_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DomainsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -652,7 +671,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -668,7 +686,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -730,7 +747,7 @@ def list_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DomainsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -750,7 +767,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -766,7 +782,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -812,7 +827,7 @@ async def list_shared_access_keys(
:rtype: ~azure.mgmt.eventgrid.models.DomainSharedAccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -834,7 +849,6 @@ async def list_shared_access_keys(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -848,7 +862,7 @@ async def list_shared_access_keys(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DomainSharedAccessKeys", pipeline_response)
+ deserialized = self._deserialize("DomainSharedAccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -938,7 +952,7 @@ async def regenerate_key(
:rtype: ~azure.mgmt.eventgrid.models.DomainSharedAccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -972,7 +986,6 @@ async def regenerate_key(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -986,7 +999,7 @@ async def regenerate_key(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DomainSharedAccessKeys", pipeline_response)
+ deserialized = self._deserialize("DomainSharedAccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_subscriptions_operations.py
index 4c214e24cdaf..a527a191d6e5 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_subscriptions_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_event_subscriptions_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +18,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +32,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._event_subscriptions_operations import (
build_create_or_update_request,
build_delete_request,
@@ -50,6 +51,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -77,6 +82,7 @@ def __init__(self, *args, **kwargs) -> None:
async def get_delivery_attributes(
self, scope: str, event_subscription_name: str, **kwargs: Any
) -> _models.DeliveryAttributeListResult:
+ # pylint: disable=line-too-long
"""Get delivery attributes for an event subscription.
Get all delivery attributes for an event subscription.
@@ -96,7 +102,7 @@ async def get_delivery_attributes(
:rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -117,7 +123,6 @@ async def get_delivery_attributes(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -131,7 +136,7 @@ async def get_delivery_attributes(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response)
+ deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -140,6 +145,7 @@ async def get_delivery_attributes(
@distributed_trace_async
async def get(self, scope: str, event_subscription_name: str, **kwargs: Any) -> _models.EventSubscription:
+ # pylint: disable=line-too-long
"""Get an event subscription.
Get properties of an event subscription.
@@ -159,7 +165,7 @@ async def get(self, scope: str, event_subscription_name: str, **kwargs: Any) ->
:rtype: ~azure.mgmt.eventgrid.models.EventSubscription
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -180,7 +186,6 @@ async def get(self, scope: str, event_subscription_name: str, **kwargs: Any) ->
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -194,7 +199,7 @@ async def get(self, scope: str, event_subscription_name: str, **kwargs: Any) ->
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -207,8 +212,8 @@ async def _create_or_update_initial(
event_subscription_name: str,
event_subscription_info: Union[_models.EventSubscription, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -221,7 +226,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -241,10 +246,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -252,10 +257,14 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -272,6 +281,7 @@ async def begin_create_or_update(
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.EventSubscription]:
+ # pylint: disable=line-too-long
"""Create or update an event subscription.
Asynchronously creates a new event subscription or updates an existing event subscription based
@@ -313,6 +323,7 @@ async def begin_create_or_update(
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.EventSubscription]:
+ # pylint: disable=line-too-long
"""Create or update an event subscription.
Asynchronously creates a new event subscription or updates an existing event subscription based
@@ -352,6 +363,7 @@ async def begin_create_or_update(
event_subscription_info: Union[_models.EventSubscription, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.EventSubscription]:
+ # pylint: disable=line-too-long
"""Create or update an event subscription.
Asynchronously creates a new event subscription or updates an existing event subscription based
@@ -400,10 +412,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -425,10 +438,8 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
- self, scope: str, event_subscription_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ async def _delete_initial(self, scope: str, event_subscription_name: str, **kwargs: Any) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -440,7 +451,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
scope=scope,
@@ -449,10 +460,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -460,6 +471,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -467,11 +482,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(self, scope: str, event_subscription_name: str, **kwargs: Any) -> AsyncLROPoller[None]:
+ # pylint: disable=line-too-long
"""Delete an event subscription.
Delete an existing event subscription.
@@ -500,7 +520,7 @@ async def begin_delete(self, scope: str, event_subscription_name: str, **kwargs:
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
scope=scope,
event_subscription_name=event_subscription_name,
api_version=api_version,
@@ -509,6 +529,7 @@ async def begin_delete(self, scope: str, event_subscription_name: str, **kwargs:
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -536,8 +557,8 @@ async def _update_initial(
event_subscription_name: str,
event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -550,7 +571,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -570,10 +591,10 @@ async def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -581,10 +602,14 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -601,6 +626,7 @@ async def begin_update(
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.EventSubscription]:
+ # pylint: disable=line-too-long
"""Update an event subscription.
Asynchronously updates an existing event subscription.
@@ -638,6 +664,7 @@ async def begin_update(
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.EventSubscription]:
+ # pylint: disable=line-too-long
"""Update an event subscription.
Asynchronously updates an existing event subscription.
@@ -672,6 +699,7 @@ async def begin_update(
event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]],
**kwargs: Any
) -> AsyncLROPoller[_models.EventSubscription]:
+ # pylint: disable=line-too-long
"""Update an event subscription.
Asynchronously updates an existing event subscription.
@@ -717,10 +745,11 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -746,6 +775,7 @@ def get_long_running_output(pipeline_response):
async def get_full_url(
self, scope: str, event_subscription_name: str, **kwargs: Any
) -> _models.EventSubscriptionFullUrl:
+ # pylint: disable=line-too-long
"""Get full URL of an event subscription.
Get the full endpoint URL for an event subscription.
@@ -765,7 +795,7 @@ async def get_full_url(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -786,7 +816,6 @@ async def get_full_url(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -800,7 +829,7 @@ async def get_full_url(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response)
+ deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -837,7 +866,7 @@ def list_global_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -856,7 +885,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -872,7 +900,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -933,7 +960,7 @@ def list_global_by_subscription_for_topic_type( # pylint: disable=name-too-long
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -953,7 +980,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -969,7 +995,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1031,7 +1056,7 @@ def list_global_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1051,7 +1076,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1067,7 +1091,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1136,7 +1159,7 @@ def list_global_by_resource_group_for_topic_type( # pylint: disable=name-too-lo
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1157,7 +1180,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1173,7 +1195,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1234,7 +1255,7 @@ def list_regional_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1254,7 +1275,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1270,7 +1290,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1340,7 +1359,7 @@ def list_regional_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1361,7 +1380,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1377,7 +1395,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1446,7 +1463,7 @@ def list_regional_by_subscription_for_topic_type( # pylint: disable=name-too-lo
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1467,7 +1484,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1483,7 +1499,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1557,7 +1572,7 @@ def list_regional_by_resource_group_for_topic_type( # pylint: disable=name-too-
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1579,7 +1594,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1595,7 +1609,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1670,7 +1683,7 @@ def list_by_resource(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1693,7 +1706,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1709,7 +1721,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1781,7 +1792,7 @@ def list_by_domain_topic(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1803,7 +1814,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1819,7 +1829,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_extension_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_extension_topics_operations.py
index fc05f56283c4..b9086a24327d 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_extension_topics_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_extension_topics_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._extension_topics_operations import build_get_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -52,6 +54,7 @@ def __init__(self, *args, **kwargs) -> None:
@distributed_trace_async
async def get(self, scope: str, **kwargs: Any) -> _models.ExtensionTopic:
+ # pylint: disable=line-too-long
"""Get properties of an extension topic.
Get the properties of an extension topic.
@@ -67,7 +70,7 @@ async def get(self, scope: str, **kwargs: Any) -> _models.ExtensionTopic:
:rtype: ~azure.mgmt.eventgrid.models.ExtensionTopic
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -87,7 +90,6 @@ async def get(self, scope: str, **kwargs: Any) -> _models.ExtensionTopic:
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -101,7 +103,7 @@ async def get(self, scope: str, **kwargs: Any) -> _models.ExtensionTopic:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ExtensionTopic", pipeline_response)
+ deserialized = self._deserialize("ExtensionTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespace_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespace_topic_event_subscriptions_operations.py
index 469aba438723..c16b43c8b721 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespace_topic_event_subscriptions_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespace_topic_event_subscriptions_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,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._namespace_topic_event_subscriptions_operations import (
build_create_or_update_request,
build_delete_request,
@@ -41,6 +41,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -90,7 +94,7 @@ async def get(
:rtype: ~azure.mgmt.eventgrid.models.Subscription
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -114,7 +118,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -129,7 +132,7 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Subscription", pipeline_response)
+ deserialized = self._deserialize("Subscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -144,8 +147,8 @@ async def _create_or_update_initial(
event_subscription_name: str,
event_subscription_info: Union[_models.Subscription, IO[bytes]],
**kwargs: Any
- ) -> _models.Subscription:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -158,7 +161,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Subscription] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -181,10 +184,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -192,15 +195,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ 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 = self._deserialize("Subscription", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Subscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -344,10 +347,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Subscription", pipeline_response)
+ deserialized = self._deserialize("Subscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -372,15 +376,15 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
namespace_name: str,
topic_name: str,
event_subscription_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -392,7 +396,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -404,10 +408,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -415,6 +419,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -423,8 +431,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -461,7 +473,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
namespace_name=namespace_name,
topic_name=topic_name,
@@ -472,6 +484,7 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -503,8 +516,8 @@ async def _update_initial(
event_subscription_name: str,
event_subscription_update_parameters: Union[_models.SubscriptionUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.Subscription:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -517,7 +530,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Subscription] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -540,10 +553,10 @@ async def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -551,18 +564,19 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("Subscription", pipeline_response)
-
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
- deserialized = self._deserialize("Subscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -697,10 +711,11 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Subscription", pipeline_response)
+ deserialized = self._deserialize("Subscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -768,7 +783,7 @@ def list_by_namespace_topic(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.SubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -790,7 +805,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -806,7 +820,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -862,7 +875,7 @@ async def get_delivery_attributes(
:rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -886,7 +899,6 @@ async def get_delivery_attributes(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -901,7 +913,7 @@ async def get_delivery_attributes(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response)
+ deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -934,7 +946,7 @@ async def get_full_url(
:rtype: ~azure.mgmt.eventgrid.models.SubscriptionFullUrl
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -958,7 +970,6 @@ async def get_full_url(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -973,7 +984,7 @@ async def get_full_url(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SubscriptionFullUrl", pipeline_response)
+ deserialized = self._deserialize("SubscriptionFullUrl", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespace_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespace_topics_operations.py
index 655982e80d91..b0494d5d5d38 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespace_topics_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespace_topics_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +18,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +32,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._namespace_topics_operations import (
build_create_or_update_request,
build_delete_request,
@@ -41,6 +42,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -83,7 +88,7 @@ async def get(
:rtype: ~azure.mgmt.eventgrid.models.NamespaceTopic
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -106,7 +111,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -121,7 +125,7 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NamespaceTopic", pipeline_response)
+ deserialized = self._deserialize("NamespaceTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -135,8 +139,8 @@ async def _create_or_update_initial(
topic_name: str,
namespace_topic_info: Union[_models.NamespaceTopic, IO[bytes]],
**kwargs: Any
- ) -> _models.NamespaceTopic:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -149,7 +153,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.NamespaceTopic] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -171,10 +175,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -182,15 +186,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ 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 = self._deserialize("NamespaceTopic", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("NamespaceTopic", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -313,10 +317,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("NamespaceTopic", pipeline_response)
+ deserialized = self._deserialize("NamespaceTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -341,10 +346,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -356,7 +361,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -367,10 +372,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -378,6 +383,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -386,8 +395,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -417,7 +430,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
namespace_name=namespace_name,
topic_name=topic_name,
@@ -427,6 +440,7 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -457,8 +471,8 @@ async def _update_initial(
topic_name: str,
namespace_topic_update_parameters: Union[_models.NamespaceTopicUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.NamespaceTopic:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -471,7 +485,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.NamespaceTopic] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -493,10 +507,10 @@ async def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -504,18 +518,19 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("NamespaceTopic", pipeline_response)
-
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
- deserialized = self._deserialize("NamespaceTopic", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -640,10 +655,11 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("NamespaceTopic", pipeline_response)
+ deserialized = self._deserialize("NamespaceTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -708,7 +724,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.NamespaceTopicsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -729,7 +745,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -745,7 +760,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -794,7 +808,7 @@ async def list_shared_access_keys(
:rtype: ~azure.mgmt.eventgrid.models.TopicSharedAccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -817,7 +831,6 @@ async def list_shared_access_keys(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -832,7 +845,7 @@ async def list_shared_access_keys(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response)
+ deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -846,8 +859,8 @@ async def _regenerate_key_initial(
topic_name: str,
regenerate_key_request: Union[_models.TopicRegenerateKeyRequest, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.TopicSharedAccessKeys]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -860,7 +873,7 @@ async def _regenerate_key_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.TopicSharedAccessKeys]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -882,10 +895,10 @@ async def _regenerate_key_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -893,18 +906,20 @@ async def _regenerate_key_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response)
-
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1027,10 +1042,11 @@ async def begin_regenerate_key(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response)
+ deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespaces_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespaces_operations.py
index 4679ef581539..c5b88b4ad0fc 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_namespaces_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +18,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +32,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._namespaces_operations import (
build_create_or_update_request,
build_delete_request,
@@ -43,6 +44,10 @@
build_validate_custom_domain_ownership_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -81,7 +86,7 @@ async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any
:rtype: ~azure.mgmt.eventgrid.models.Namespace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -103,7 +108,6 @@ async def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -118,7 +122,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)
- deserialized = self._deserialize("Namespace", pipeline_response)
+ deserialized = self._deserialize("Namespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -131,8 +135,8 @@ async def _create_or_update_initial(
namespace_name: str,
namespace_info: Union[_models.Namespace, IO[bytes]],
**kwargs: Any
- ) -> _models.Namespace:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -145,7 +149,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Namespace] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -166,10 +170,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -177,15 +181,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ 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 = self._deserialize("Namespace", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Namespace", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -298,10 +302,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Namespace", pipeline_response)
+ deserialized = self._deserialize("Namespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -326,10 +331,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, namespace_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -341,7 +346,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -351,10 +356,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -362,6 +367,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -370,8 +379,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> AsyncLROPoller[None]:
@@ -397,7 +410,7 @@ async def begin_delete(self, resource_group_name: str, namespace_name: str, **kw
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
namespace_name=namespace_name,
api_version=api_version,
@@ -406,6 +419,7 @@ async def begin_delete(self, resource_group_name: str, namespace_name: str, **kw
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -435,8 +449,8 @@ async def _update_initial(
namespace_name: str,
namespace_update_parameters: Union[_models.NamespaceUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.Namespace:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -449,7 +463,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Namespace] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -470,10 +484,10 @@ async def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -481,18 +495,19 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("Namespace", pipeline_response)
-
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
- deserialized = self._deserialize("Namespace", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -606,10 +621,11 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Namespace", pipeline_response)
+ deserialized = self._deserialize("Namespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -664,7 +680,7 @@ def list_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.NamespacesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -683,7 +699,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -699,7 +714,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -762,7 +776,7 @@ def list_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.NamespacesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -782,7 +796,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -798,7 +811,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -845,7 +857,7 @@ async def list_shared_access_keys(
:rtype: ~azure.mgmt.eventgrid.models.NamespaceSharedAccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -867,7 +879,6 @@ async def list_shared_access_keys(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -882,7 +893,7 @@ async def list_shared_access_keys(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NamespaceSharedAccessKeys", pipeline_response)
+ deserialized = self._deserialize("NamespaceSharedAccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -895,8 +906,8 @@ async def _regenerate_key_initial(
namespace_name: str,
regenerate_key_request: Union[_models.NamespaceRegenerateKeyRequest, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.NamespaceSharedAccessKeys]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -909,7 +920,7 @@ async def _regenerate_key_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.NamespaceSharedAccessKeys]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -930,10 +941,10 @@ async def _regenerate_key_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -941,18 +952,20 @@ async def _regenerate_key_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("NamespaceSharedAccessKeys", pipeline_response)
-
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1068,10 +1081,11 @@ async def begin_regenerate_key(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("NamespaceSharedAccessKeys", pipeline_response)
+ deserialized = self._deserialize("NamespaceSharedAccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -1097,8 +1111,8 @@ def get_long_running_output(pipeline_response):
async def _validate_custom_domain_ownership_initial( # pylint: disable=name-too-long
self, resource_group_name: str, namespace_name: str, **kwargs: Any
- ) -> Optional[_models.CustomDomainOwnershipValidationResult]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1110,7 +1124,7 @@ async def _validate_custom_domain_ownership_initial( # pylint: disable=name-too
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[Optional[_models.CustomDomainOwnershipValidationResult]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_validate_custom_domain_ownership_request(
resource_group_name=resource_group_name,
@@ -1120,10 +1134,10 @@ async def _validate_custom_domain_ownership_initial( # pylint: disable=name-too
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -1131,18 +1145,20 @@ async def _validate_custom_domain_ownership_initial( # pylint: disable=name-too
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("CustomDomainOwnershipValidationResult", pipeline_response)
-
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1185,10 +1201,11 @@ async def begin_validate_custom_domain_ownership(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("CustomDomainOwnershipValidationResult", pipeline_response)
+ deserialized = self._deserialize("CustomDomainOwnershipValidationResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_network_security_perimeter_configurations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_network_security_perimeter_configurations_operations.py
index b0e6fbf39246..2cadf7033c8e 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_network_security_perimeter_configurations_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/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.
@@ -6,7 +5,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast
+import sys
+from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, TypeVar, Union, cast
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
@@ -16,12 +16,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -29,13 +30,16 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._network_security_perimeter_configurations_operations import (
build_get_request,
build_list_request,
build_reconcile_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -76,8 +80,8 @@ async def get(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param resource_type: The type of the resource. This can be either \'topics\', or \'domains\'.
- Known values are: "topics" and "domains". Required.
+ :param resource_type: The type of the resource. This can be either \\'topics\\', or
+ \\'domains\\'. Known values are: "topics" and "domains". Required.
:type resource_type: str or ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterResourceType
:param resource_name: The name of the resource (namely, either, the topic name or domain name).
Required.
@@ -91,7 +95,7 @@ async def get(
:rtype: ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -116,7 +120,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -131,7 +134,7 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response)
+ deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -146,8 +149,8 @@ async def _reconcile_initial(
perimeter_guid: str,
association_name: str,
**kwargs: Any
- ) -> Optional[_models.NetworkSecurityPerimeterConfiguration]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -159,7 +162,7 @@ async def _reconcile_initial(
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[Optional[_models.NetworkSecurityPerimeterConfiguration]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_reconcile_request(
resource_group_name=resource_group_name,
@@ -172,10 +175,10 @@ async def _reconcile_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -183,18 +186,20 @@ async def _reconcile_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response)
-
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -219,8 +224,8 @@ async def begin_reconcile(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param resource_type: The type of the resource. This can be either \'topics\' or \'domains\'.
- Known values are: "topics" and "domains". Required.
+ :param resource_type: The type of the resource. This can be either \\'topics\\' or
+ \\'domains\\'. Known values are: "topics" and "domains". Required.
:type resource_type: str or ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterResourceType
:param resource_name: The name of the resource (namely, either, the topic name or domain name).
Required.
@@ -257,10 +262,11 @@ async def begin_reconcile(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response)
+ deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -299,8 +305,8 @@ def list(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param resource_type: The type of the resource. This can be either \'topics\' or \'domains\'.
- Known values are: "topics" and "domains". Required.
+ :param resource_type: The type of the resource. This can be either \\'topics\\' or
+ \\'domains\\'. Known values are: "topics" and "domains". Required.
:type resource_type: str or ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterResourceType
:param resource_name: The name of the resource (namely, either, the topic name or domain name).
Required.
@@ -317,7 +323,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.NetworkSecurityPerimeterConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -337,7 +343,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -353,7 +358,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_operations.py
index dc9d3839e9ed..ae1551862aff 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/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.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._operations import build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -68,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -84,7 +86,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -100,7 +101,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_configurations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_configurations_operations.py
index 7f56fd18ad32..736eddc29b57 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_configurations_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_configurations_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +18,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +32,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._partner_configurations_operations import (
build_authorize_partner_request,
build_create_or_update_request,
@@ -42,6 +43,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -78,7 +83,7 @@ async def get(self, resource_group_name: str, **kwargs: Any) -> _models.PartnerC
:rtype: ~azure.mgmt.eventgrid.models.PartnerConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -99,7 +104,6 @@ async def get(self, resource_group_name: str, **kwargs: Any) -> _models.PartnerC
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -113,7 +117,7 @@ async def get(self, resource_group_name: str, **kwargs: Any) -> _models.PartnerC
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerConfiguration", pipeline_response)
+ deserialized = self._deserialize("PartnerConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -125,8 +129,8 @@ async def _create_or_update_initial(
resource_group_name: str,
partner_configuration_info: Union[_models.PartnerConfiguration, IO[bytes]],
**kwargs: Any
- ) -> _models.PartnerConfiguration:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -139,7 +143,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PartnerConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -159,10 +163,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -170,14 +174,14 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("PartnerConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PartnerConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -281,10 +285,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PartnerConfiguration", pipeline_response)
+ deserialized = self._deserialize("PartnerConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -306,10 +311,8 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ async def _delete_initial(self, resource_group_name: str, **kwargs: Any) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -321,7 +324,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -330,10 +333,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -341,6 +344,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -348,8 +355,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(self, resource_group_name: str, **kwargs: Any) -> AsyncLROPoller[None]:
@@ -373,7 +384,7 @@ async def begin_delete(self, resource_group_name: str, **kwargs: Any) -> AsyncLR
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
api_version=api_version,
cls=lambda x, y, z: x,
@@ -381,6 +392,7 @@ async def begin_delete(self, resource_group_name: str, **kwargs: Any) -> AsyncLR
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -407,8 +419,8 @@ async def _update_initial(
resource_group_name: str,
partner_configuration_update_parameters: Union[_models.PartnerConfigurationUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.PartnerConfiguration:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -421,7 +433,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PartnerConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -443,10 +455,10 @@ async def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -454,14 +466,14 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("PartnerConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PartnerConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -568,10 +580,11 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PartnerConfiguration", pipeline_response)
+ deserialized = self._deserialize("PartnerConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -616,7 +629,7 @@ def list_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartnerConfigurationsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -634,7 +647,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -650,7 +662,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -711,7 +722,7 @@ def list_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartnerConfigurationsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -730,7 +741,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -746,7 +756,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -845,7 +854,7 @@ async def authorize_partner(
:rtype: ~azure.mgmt.eventgrid.models.PartnerConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -878,7 +887,6 @@ async def authorize_partner(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -892,7 +900,7 @@ async def authorize_partner(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerConfiguration", pipeline_response)
+ deserialized = self._deserialize("PartnerConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -969,7 +977,7 @@ async def unauthorize_partner(
:rtype: ~azure.mgmt.eventgrid.models.PartnerConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1002,7 +1010,6 @@ async def unauthorize_partner(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1016,7 +1023,7 @@ async def unauthorize_partner(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerConfiguration", pipeline_response)
+ deserialized = self._deserialize("PartnerConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_destinations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_destinations_operations.py
index cb00bb0c8de7..43a912979f65 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_destinations_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_destinations_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,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._partner_destinations_operations import (
build_activate_request,
build_create_or_update_request,
@@ -41,6 +41,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -81,7 +85,7 @@ async def get(
:rtype: ~azure.mgmt.eventgrid.models.PartnerDestination
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -103,7 +107,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -118,7 +121,7 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerDestination", pipeline_response)
+ deserialized = self._deserialize("PartnerDestination", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -131,8 +134,8 @@ async def _create_or_update_initial(
partner_destination_name: str,
partner_destination: Union[_models.PartnerDestination, IO[bytes]],
**kwargs: Any
- ) -> _models.PartnerDestination:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -145,7 +148,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PartnerDestination] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -166,10 +169,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -177,15 +180,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ 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 = self._deserialize("PartnerDestination", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PartnerDestination", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -298,10 +301,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PartnerDestination", pipeline_response)
+ deserialized = self._deserialize("PartnerDestination", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -326,10 +330,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, partner_destination_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -341,7 +345,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -351,10 +355,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -362,6 +366,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -370,8 +378,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -399,7 +411,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
partner_destination_name=partner_destination_name,
api_version=api_version,
@@ -408,6 +420,7 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -437,8 +450,8 @@ async def _update_initial(
partner_destination_name: str,
partner_destination_update_parameters: Union[_models.PartnerDestinationUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.PartnerDestination:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -451,7 +464,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PartnerDestination] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -472,10 +485,10 @@ async def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -483,21 +496,19 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("PartnerDestination", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PartnerDestination", pipeline_response)
-
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
- deserialized = self._deserialize("PartnerDestination", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -612,10 +623,11 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PartnerDestination", pipeline_response)
+ deserialized = self._deserialize("PartnerDestination", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -671,7 +683,7 @@ def list_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartnerDestinationsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -690,7 +702,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -706,7 +717,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -770,7 +780,7 @@ def list_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartnerDestinationsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -790,7 +800,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -806,7 +815,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -853,7 +861,7 @@ async def activate(
:rtype: ~azure.mgmt.eventgrid.models.PartnerDestination
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -875,7 +883,6 @@ async def activate(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -890,7 +897,7 @@ async def activate(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerDestination", pipeline_response)
+ deserialized = self._deserialize("PartnerDestination", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_namespaces_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_namespaces_operations.py
index e5285834e71c..5ec3661dd616 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_namespaces_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +18,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +32,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._partner_namespaces_operations import (
build_create_or_update_request,
build_delete_request,
@@ -42,6 +43,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -82,7 +87,7 @@ async def get(
:rtype: ~azure.mgmt.eventgrid.models.PartnerNamespace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -104,7 +109,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -119,7 +123,7 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerNamespace", pipeline_response)
+ deserialized = self._deserialize("PartnerNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -132,8 +136,8 @@ async def _create_or_update_initial(
partner_namespace_name: str,
partner_namespace_info: Union[_models.PartnerNamespace, IO[bytes]],
**kwargs: Any
- ) -> _models.PartnerNamespace:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -146,7 +150,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PartnerNamespace] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -167,10 +171,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -178,11 +182,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerNamespace", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -295,10 +303,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PartnerNamespace", pipeline_response)
+ deserialized = self._deserialize("PartnerNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -320,10 +329,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, partner_namespace_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -335,7 +344,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -345,10 +354,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -356,6 +365,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -364,8 +377,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -393,7 +410,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
partner_namespace_name=partner_namespace_name,
api_version=api_version,
@@ -402,6 +419,7 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -429,8 +447,8 @@ async def _update_initial(
partner_namespace_name: str,
partner_namespace_update_parameters: Union[_models.PartnerNamespaceUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.PartnerNamespace]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -443,7 +461,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.PartnerNamespace]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -464,10 +482,10 @@ async def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -475,13 +493,15 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 201:
- deserialized = self._deserialize("PartnerNamespace", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -596,10 +616,11 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PartnerNamespace", pipeline_response)
+ deserialized = self._deserialize("PartnerNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -651,7 +672,7 @@ def list_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartnerNamespacesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -670,7 +691,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -686,7 +706,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -749,7 +768,7 @@ def list_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartnerNamespacesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -769,7 +788,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -785,7 +803,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -832,7 +849,7 @@ async def list_shared_access_keys(
:rtype: ~azure.mgmt.eventgrid.models.PartnerNamespaceSharedAccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -854,7 +871,6 @@ async def list_shared_access_keys(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -869,7 +885,7 @@ async def list_shared_access_keys(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerNamespaceSharedAccessKeys", pipeline_response)
+ deserialized = self._deserialize("PartnerNamespaceSharedAccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -959,7 +975,7 @@ async def regenerate_key(
:rtype: ~azure.mgmt.eventgrid.models.PartnerNamespaceSharedAccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -993,7 +1009,6 @@ async def regenerate_key(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1008,7 +1023,7 @@ async def regenerate_key(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerNamespaceSharedAccessKeys", pipeline_response)
+ deserialized = self._deserialize("PartnerNamespaceSharedAccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_registrations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_registrations_operations.py
index d6e486c592c6..b4bfff4445cc 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_registrations_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_registrations_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,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._partner_registrations_operations import (
build_create_or_update_request,
build_delete_request,
@@ -40,6 +40,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -80,7 +84,7 @@ async def get(
:rtype: ~azure.mgmt.eventgrid.models.PartnerRegistration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -102,7 +106,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -116,7 +119,7 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerRegistration", pipeline_response)
+ deserialized = self._deserialize("PartnerRegistration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -129,8 +132,8 @@ async def _create_or_update_initial(
partner_registration_name: str,
partner_registration_info: Union[_models.PartnerRegistration, IO[bytes]],
**kwargs: Any
- ) -> _models.PartnerRegistration:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -143,7 +146,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PartnerRegistration] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -164,10 +167,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -175,17 +178,18 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("PartnerRegistration", pipeline_response)
-
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
- deserialized = self._deserialize("PartnerRegistration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -298,10 +302,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PartnerRegistration", pipeline_response)
+ deserialized = self._deserialize("PartnerRegistration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -323,10 +328,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, partner_registration_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -338,7 +343,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -348,10 +353,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -359,6 +364,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -366,8 +375,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -395,7 +408,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
partner_registration_name=partner_registration_name,
api_version=api_version,
@@ -404,6 +417,7 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -431,8 +445,8 @@ async def _update_initial(
partner_registration_name: str,
partner_registration_update_parameters: Union[_models.PartnerRegistrationUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.PartnerRegistration]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -445,7 +459,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.PartnerRegistration]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -466,10 +480,10 @@ async def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -477,12 +491,14 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 201:
- deserialized = self._deserialize("PartnerRegistration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -599,10 +615,11 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PartnerRegistration", pipeline_response)
+ deserialized = self._deserialize("PartnerRegistration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -655,7 +672,7 @@ def list_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartnerRegistrationsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -674,7 +691,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -690,7 +706,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -753,7 +768,7 @@ def list_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartnerRegistrationsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -773,7 +788,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -789,7 +803,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topic_event_subscriptions_operations.py
index d247a4dc5e03..cd756e6cfc51 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topic_event_subscriptions_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topic_event_subscriptions_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,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._partner_topic_event_subscriptions_operations import (
build_create_or_update_request,
build_delete_request,
@@ -41,6 +41,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -83,7 +87,7 @@ async def get(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscription
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -106,7 +110,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -120,7 +123,7 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -134,8 +137,8 @@ async def _create_or_update_initial(
event_subscription_name: str,
event_subscription_info: Union[_models.EventSubscription, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -148,7 +151,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -170,10 +173,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -181,14 +184,14 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("EventSubscription", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -322,10 +325,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -347,10 +351,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, partner_topic_name: str, event_subscription_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -362,7 +366,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -373,10 +377,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -384,6 +388,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -391,8 +399,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -422,7 +434,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
partner_topic_name=partner_topic_name,
event_subscription_name=event_subscription_name,
@@ -432,6 +444,7 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -460,8 +473,8 @@ async def _update_initial(
event_subscription_name: str,
event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -474,7 +487,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -496,10 +509,10 @@ async def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -507,10 +520,14 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -635,10 +652,11 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -679,7 +697,7 @@ async def get_full_url(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -702,7 +720,6 @@ async def get_full_url(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -716,7 +733,7 @@ async def get_full_url(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response)
+ deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -763,7 +780,7 @@ def list_by_partner_topic(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -784,7 +801,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -800,7 +816,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -848,7 +863,7 @@ async def get_delivery_attributes(
:rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -871,7 +886,6 @@ async def get_delivery_attributes(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -885,7 +899,7 @@ async def get_delivery_attributes(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response)
+ deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topics_operations.py
index 23d1dfb5ac35..5da2f90f23c6 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topics_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_partner_topics_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,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._partner_topics_operations import (
build_activate_request,
build_create_or_update_request,
@@ -42,6 +42,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -80,7 +84,7 @@ async def get(self, resource_group_name: str, partner_topic_name: str, **kwargs:
:rtype: ~azure.mgmt.eventgrid.models.PartnerTopic
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -102,7 +106,6 @@ async def get(self, resource_group_name: str, partner_topic_name: str, **kwargs:
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -116,7 +119,7 @@ async def get(self, resource_group_name: str, partner_topic_name: str, **kwargs:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerTopic", pipeline_response)
+ deserialized = self._deserialize("PartnerTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -205,7 +208,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.eventgrid.models.PartnerTopic
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -239,7 +242,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -253,21 +255,17 @@ async def create_or_update(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("PartnerTopic", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PartnerTopic", pipeline_response)
+ deserialized = self._deserialize("PartnerTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, partner_topic_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -279,7 +277,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -289,10 +287,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -300,6 +298,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -307,8 +309,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -336,7 +342,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
partner_topic_name=partner_topic_name,
api_version=api_version,
@@ -345,6 +351,7 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -450,7 +457,7 @@ async def update(
:rtype: ~azure.mgmt.eventgrid.models.PartnerTopic or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -484,7 +491,6 @@ async def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -500,7 +506,7 @@ async def update(
deserialized = None
if response.status_code == 201:
- deserialized = self._deserialize("PartnerTopic", pipeline_response)
+ deserialized = self._deserialize("PartnerTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -537,7 +543,7 @@ def list_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartnerTopicsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -556,7 +562,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -572,7 +577,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -634,7 +638,7 @@ def list_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartnerTopicsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -654,7 +658,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -670,7 +673,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -714,7 +716,7 @@ async def activate(self, resource_group_name: str, partner_topic_name: str, **kw
:rtype: ~azure.mgmt.eventgrid.models.PartnerTopic
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -736,7 +738,6 @@ async def activate(self, resource_group_name: str, partner_topic_name: str, **kw
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -750,7 +751,7 @@ async def activate(self, resource_group_name: str, partner_topic_name: str, **kw
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerTopic", pipeline_response)
+ deserialized = self._deserialize("PartnerTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -774,7 +775,7 @@ async def deactivate(
:rtype: ~azure.mgmt.eventgrid.models.PartnerTopic
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -796,7 +797,6 @@ async def deactivate(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -810,7 +810,7 @@ async def deactivate(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerTopic", pipeline_response)
+ deserialized = self._deserialize("PartnerTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_permission_bindings_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_permission_bindings_operations.py
index b368d2860d98..8b6bf8458f6d 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_permission_bindings_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_permission_bindings_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,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._permission_bindings_operations import (
build_create_or_update_request,
build_delete_request,
@@ -38,6 +38,10 @@
build_list_by_namespace_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -80,7 +84,7 @@ async def get(
:rtype: ~azure.mgmt.eventgrid.models.PermissionBinding
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -103,7 +107,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -118,7 +121,7 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PermissionBinding", pipeline_response)
+ deserialized = self._deserialize("PermissionBinding", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -132,8 +135,8 @@ async def _create_or_update_initial(
permission_binding_name: str,
permission_binding_info: Union[_models.PermissionBinding, IO[bytes]],
**kwargs: Any
- ) -> _models.PermissionBinding:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -146,7 +149,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PermissionBinding] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -168,10 +171,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -179,15 +182,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ 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 = self._deserialize("PermissionBinding", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PermissionBinding", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -310,10 +313,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PermissionBinding", pipeline_response)
+ deserialized = self._deserialize("PermissionBinding", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -338,10 +342,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, namespace_name: str, permission_binding_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -353,7 +357,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -364,10 +368,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -375,6 +379,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -383,8 +391,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -414,7 +426,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
namespace_name=namespace_name,
permission_binding_name=permission_binding_name,
@@ -424,6 +436,7 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -487,7 +500,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PermissionBindingsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -508,7 +521,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -524,7 +536,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_endpoint_connections_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_endpoint_connections_operations.py
index 57df616fc473..c8d1f0c9d506 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_endpoint_connections_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/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.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._private_endpoint_connections_operations import (
build_delete_request,
build_get_request,
@@ -38,6 +38,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -78,9 +82,9 @@ async def get(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param parent_type: The type of the parent resource. This can be either \'topics\',
- \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains",
- "partnerNamespaces", and "namespaces". Required.
+ :param parent_type: The type of the parent resource. This can be either \\'topics\\',
+ \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics",
+ "domains", "partnerNamespaces", and "namespaces". Required.
:type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType
:param parent_name: The name of the parent resource (namely, either, the topic name, domain
name, or partner namespace name or namespace name). Required.
@@ -92,7 +96,7 @@ async def get(
:rtype: ~azure.mgmt.eventgrid.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -116,7 +120,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -130,7 +133,7 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -145,8 +148,8 @@ async def _update_initial(
private_endpoint_connection_name: str,
private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
- ) -> _models.PrivateEndpointConnection:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -159,7 +162,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -182,10 +185,10 @@ async def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -193,14 +196,14 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -226,9 +229,9 @@ async def begin_update(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param parent_type: The type of the parent resource. This can be either \'topics\',
- \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains",
- "partnerNamespaces", and "namespaces". Required.
+ :param parent_type: The type of the parent resource. This can be either \\'topics\\',
+ \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics",
+ "domains", "partnerNamespaces", and "namespaces". Required.
:type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType
:param parent_name: The name of the parent resource (namely, either, the topic name, domain
name, or partner namespace name or namespace name). Required.
@@ -267,9 +270,9 @@ async def begin_update(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param parent_type: The type of the parent resource. This can be either \'topics\',
- \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains",
- "partnerNamespaces", and "namespaces". Required.
+ :param parent_type: The type of the parent resource. This can be either \\'topics\\',
+ \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics",
+ "domains", "partnerNamespaces", and "namespaces". Required.
:type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType
:param parent_name: The name of the parent resource (namely, either, the topic name, domain
name, or partner namespace name or namespace name). Required.
@@ -306,9 +309,9 @@ async def begin_update(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param parent_type: The type of the parent resource. This can be either \'topics\',
- \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains",
- "partnerNamespaces", and "namespaces". Required.
+ :param parent_type: The type of the parent resource. This can be either \\'topics\\',
+ \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics",
+ "domains", "partnerNamespaces", and "namespaces". Required.
:type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType
:param parent_name: The name of the parent resource (namely, either, the topic name, domain
name, or partner namespace name or namespace name). Required.
@@ -349,10 +352,11 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -374,15 +378,15 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self,
resource_group_name: str,
parent_type: Union[str, _models.PrivateEndpointConnectionsParentType],
parent_name: str,
private_endpoint_connection_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -394,7 +398,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -406,10 +410,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -417,6 +421,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -424,8 +432,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -444,9 +456,9 @@ async def begin_delete(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param parent_type: The type of the parent resource. This can be either \'topics\',
- \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains",
- "partnerNamespaces", and "namespaces". Required.
+ :param parent_type: The type of the parent resource. This can be either \\'topics\\',
+ \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics",
+ "domains", "partnerNamespaces", and "namespaces". Required.
:type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType
:param parent_name: The name of the parent resource (namely, either, the topic name, domain
name, or partner namespace name or namespace name). Required.
@@ -467,7 +479,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
parent_type=parent_type,
parent_name=parent_name,
@@ -478,6 +490,7 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -516,9 +529,9 @@ def list_by_resource(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param parent_type: The type of the parent resource. This can be either \'topics\',
- \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains",
- "partnerNamespaces", and "namespaces". Required.
+ :param parent_type: The type of the parent resource. This can be either \\'topics\\',
+ \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics",
+ "domains", "partnerNamespaces", and "namespaces". Required.
:type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType
:param parent_name: The name of the parent resource (namely, either, the topic name, domain
name, or partner namespace name or namespace name). Required.
@@ -547,7 +560,7 @@ def list_by_resource(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -569,7 +582,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -585,7 +597,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_link_resources_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_link_resources_operations.py
index b4ffb5d72b32..6f2d3e71481f 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_private_link_resources_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/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.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,17 +19,19 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._private_link_resources_operations import build_get_request, build_list_by_resource_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -69,8 +71,8 @@ async def get(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param parent_type: The type of the parent resource. This can be either \'topics\',
- \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Required.
+ :param parent_type: The type of the parent resource. This can be either \\'topics\\',
+ \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Required.
:type parent_type: str
:param parent_name: The name of the parent resource (namely, either, the topic name, domain
name, or partner namespace name or namespace name). Required.
@@ -82,7 +84,7 @@ async def get(
:rtype: ~azure.mgmt.eventgrid.models.PrivateLinkResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -106,7 +108,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -120,7 +121,7 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateLinkResource", pipeline_response)
+ deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -144,8 +145,8 @@ def list_by_resource(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param parent_type: The type of the parent resource. This can be either \'topics\',
- \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Required.
+ :param parent_type: The type of the parent resource. This can be either \\'topics\\',
+ \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Required.
:type parent_type: str
:param parent_name: The name of the parent resource (namely, either, the topic name, domain
name, or partner namespace or namespace name). Required.
@@ -173,7 +174,7 @@ def list_by_resource(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateLinkResourcesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -195,7 +196,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -211,7 +211,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topic_event_subscriptions_operations.py
index 8b6214e9b3e7..4eb1384ff718 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topic_event_subscriptions_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topic_event_subscriptions_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,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._system_topic_event_subscriptions_operations import (
build_create_or_update_request,
build_delete_request,
@@ -41,6 +41,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -83,7 +87,7 @@ async def get_delivery_attributes(
:rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -106,7 +110,6 @@ async def get_delivery_attributes(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -120,7 +123,7 @@ async def get_delivery_attributes(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response)
+ deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -146,7 +149,7 @@ async def get(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscription
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -169,7 +172,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -183,7 +185,7 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -197,8 +199,8 @@ async def _create_or_update_initial(
event_subscription_name: str,
event_subscription_info: Union[_models.EventSubscription, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -211,7 +213,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -233,10 +235,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -244,10 +246,14 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -381,10 +387,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -406,10 +413,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, system_topic_name: str, event_subscription_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -421,7 +428,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -432,10 +439,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -443,6 +450,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -450,8 +461,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -481,7 +496,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
system_topic_name=system_topic_name,
event_subscription_name=event_subscription_name,
@@ -491,6 +506,7 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -519,8 +535,8 @@ async def _update_initial(
event_subscription_name: str,
event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -533,7 +549,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -555,10 +571,10 @@ async def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -566,10 +582,14 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -694,10 +714,11 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -738,7 +759,7 @@ async def get_full_url(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -761,7 +782,6 @@ async def get_full_url(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -775,7 +795,7 @@ async def get_full_url(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response)
+ deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -822,7 +842,7 @@ def list_by_system_topic(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -843,7 +863,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -859,7 +878,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topics_operations.py
index c5fa1ad47125..a449a8a99aa9 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topics_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_system_topics_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,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._system_topics_operations import (
build_create_or_update_request,
build_delete_request,
@@ -40,6 +40,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -78,7 +82,7 @@ async def get(self, resource_group_name: str, system_topic_name: str, **kwargs:
:rtype: ~azure.mgmt.eventgrid.models.SystemTopic
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -100,7 +104,6 @@ async def get(self, resource_group_name: str, system_topic_name: str, **kwargs:
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -114,7 +117,7 @@ async def get(self, resource_group_name: str, system_topic_name: str, **kwargs:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SystemTopic", pipeline_response)
+ deserialized = self._deserialize("SystemTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -127,8 +130,8 @@ async def _create_or_update_initial(
system_topic_name: str,
system_topic_info: Union[_models.SystemTopic, IO[bytes]],
**kwargs: Any
- ) -> _models.SystemTopic:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -141,7 +144,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.SystemTopic] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -162,10 +165,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -173,14 +176,14 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("SystemTopic", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SystemTopic", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -293,10 +296,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("SystemTopic", pipeline_response)
+ deserialized = self._deserialize("SystemTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -318,10 +322,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, system_topic_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -333,7 +337,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -343,10 +347,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -354,6 +358,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -361,8 +369,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -390,7 +402,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
system_topic_name=system_topic_name,
api_version=api_version,
@@ -399,6 +411,7 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -426,8 +439,8 @@ async def _update_initial(
system_topic_name: str,
system_topic_update_parameters: Union[_models.SystemTopicUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.SystemTopic:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -440,7 +453,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.SystemTopic] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -461,10 +474,10 @@ async def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -472,14 +485,14 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("SystemTopic", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SystemTopic", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -593,10 +606,11 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("SystemTopic", pipeline_response)
+ deserialized = self._deserialize("SystemTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -648,7 +662,7 @@ def list_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.SystemTopicsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -667,7 +681,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -683,7 +696,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -745,7 +757,7 @@ def list_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.SystemTopicsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -765,7 +777,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -781,7 +792,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_event_subscriptions_operations.py
index 0c7eaa7023f0..df66e54467ef 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_event_subscriptions_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_event_subscriptions_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,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._topic_event_subscriptions_operations import (
build_create_or_update_request,
build_delete_request,
@@ -41,6 +41,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -83,7 +87,7 @@ async def get_delivery_attributes(
:rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -106,7 +110,6 @@ async def get_delivery_attributes(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -120,7 +123,7 @@ async def get_delivery_attributes(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response)
+ deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -146,7 +149,7 @@ async def get(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscription
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -169,7 +172,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -183,7 +185,7 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -197,8 +199,8 @@ async def _create_or_update_initial(
event_subscription_name: str,
event_subscription_info: Union[_models.EventSubscription, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -211,7 +213,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -233,10 +235,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -244,14 +246,14 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("EventSubscription", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -382,10 +384,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -407,10 +410,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, topic_name: str, event_subscription_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -422,7 +425,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -433,10 +436,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -444,6 +447,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -451,8 +458,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -482,7 +493,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
topic_name=topic_name,
event_subscription_name=event_subscription_name,
@@ -492,6 +503,7 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -520,8 +532,8 @@ async def _update_initial(
event_subscription_name: str,
event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -534,7 +546,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -556,10 +568,10 @@ async def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -567,10 +579,14 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -695,10 +711,11 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -739,7 +756,7 @@ async def get_full_url(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -762,7 +779,6 @@ async def get_full_url(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -776,7 +792,7 @@ async def get_full_url(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response)
+ deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -823,7 +839,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -844,7 +860,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -860,7 +875,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_spaces_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_spaces_operations.py
index e183445fc290..bb9acdb6a0b5 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_spaces_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_spaces_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,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +17,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +31,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._topic_spaces_operations import (
build_create_or_update_request,
build_delete_request,
@@ -38,6 +38,10 @@
build_list_by_namespace_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -80,7 +84,7 @@ async def get(
:rtype: ~azure.mgmt.eventgrid.models.TopicSpace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -103,7 +107,6 @@ async def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -118,7 +121,7 @@ async def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("TopicSpace", pipeline_response)
+ deserialized = self._deserialize("TopicSpace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -132,8 +135,8 @@ async def _create_or_update_initial(
topic_space_name: str,
topic_space_info: Union[_models.TopicSpace, IO[bytes]],
**kwargs: Any
- ) -> _models.TopicSpace:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -146,7 +149,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.TopicSpace] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -168,10 +171,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -179,15 +182,15 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ 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 = self._deserialize("TopicSpace", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("TopicSpace", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -310,10 +313,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("TopicSpace", pipeline_response)
+ deserialized = self._deserialize("TopicSpace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -338,10 +342,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
+ async def _delete_initial(
self, resource_group_name: str, namespace_name: str, topic_space_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -353,7 +357,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -364,10 +368,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -375,6 +379,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -383,8 +391,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(
@@ -414,7 +426,7 @@ async def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
namespace_name=namespace_name,
topic_space_name=topic_space_name,
@@ -424,6 +436,7 @@ async def begin_delete(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -487,7 +500,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TopicSpacesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -508,7 +521,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -524,7 +536,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_types_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_types_operations.py
index 6956022e3da0..2cbd6fb32160 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_types_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topic_types_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,17 +19,19 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._topic_types_operations import build_get_request, build_list_event_types_request, build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -69,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.TopicTypeInfo"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TopicTypesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -85,7 +87,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -101,7 +102,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -142,7 +142,7 @@ async def get(self, topic_type_name: str, **kwargs: Any) -> _models.TopicTypeInf
:rtype: ~azure.mgmt.eventgrid.models.TopicTypeInfo
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -162,7 +162,6 @@ async def get(self, topic_type_name: str, **kwargs: Any) -> _models.TopicTypeInf
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -176,7 +175,7 @@ async def get(self, topic_type_name: str, **kwargs: Any) -> _models.TopicTypeInf
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("TopicTypeInfo", pipeline_response)
+ deserialized = self._deserialize("TopicTypeInfo", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -201,7 +200,7 @@ def list_event_types(self, topic_type_name: str, **kwargs: Any) -> AsyncIterable
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventTypesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -218,7 +217,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -234,7 +232,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topics_operations.py
index 51e988ec426d..c83674b3e8cf 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topics_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_topics_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
+import sys
+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
@@ -17,12 +18,13 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
@@ -30,7 +32,6 @@
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._topics_operations import (
build_create_or_update_request,
build_delete_request,
@@ -43,6 +44,10 @@
build_update_request,
)
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -81,7 +86,7 @@ async def get(self, resource_group_name: str, topic_name: str, **kwargs: Any) ->
:rtype: ~azure.mgmt.eventgrid.models.Topic
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -103,7 +108,6 @@ async def get(self, resource_group_name: str, topic_name: str, **kwargs: Any) ->
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -117,7 +121,7 @@ async def get(self, resource_group_name: str, topic_name: str, **kwargs: Any) ->
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Topic", pipeline_response)
+ deserialized = self._deserialize("Topic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -126,8 +130,8 @@ async def get(self, resource_group_name: str, topic_name: str, **kwargs: Any) ->
async def _create_or_update_initial(
self, resource_group_name: str, topic_name: str, topic_info: Union[_models.Topic, IO[bytes]], **kwargs: Any
- ) -> _models.Topic:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -140,7 +144,7 @@ async def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Topic] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -161,10 +165,10 @@ async def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -172,10 +176,14 @@ async def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Topic", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -280,10 +288,11 @@ async def begin_create_or_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Topic", pipeline_response)
+ deserialized = self._deserialize("Topic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -305,10 +314,8 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- async def _delete_initial( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, topic_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ async def _delete_initial(self, resource_group_name: str, topic_name: str, **kwargs: Any) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -320,7 +327,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -330,10 +337,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -341,6 +348,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -348,8 +359,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace_async
async def begin_delete(self, resource_group_name: str, topic_name: str, **kwargs: Any) -> AsyncLROPoller[None]:
@@ -375,7 +390,7 @@ async def begin_delete(self, resource_group_name: str, topic_name: str, **kwargs
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = await self._delete_initial( # type: ignore
+ raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
topic_name=topic_name,
api_version=api_version,
@@ -384,6 +399,7 @@ async def begin_delete(self, resource_group_name: str, topic_name: str, **kwargs
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -411,8 +427,8 @@ async def _update_initial(
topic_name: str,
topic_update_parameters: Union[_models.TopicUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.Topic]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -425,7 +441,7 @@ async def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.Topic]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -446,10 +462,10 @@ async def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -457,12 +473,14 @@ async def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 201:
- deserialized = self._deserialize("Topic", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -572,10 +590,11 @@ async def begin_update(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Topic", pipeline_response)
+ deserialized = self._deserialize("Topic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -627,7 +646,7 @@ def list_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TopicsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -646,7 +665,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -662,7 +680,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -724,7 +741,7 @@ def list_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TopicsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -744,7 +761,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -760,7 +776,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -806,7 +821,7 @@ async def list_shared_access_keys(
:rtype: ~azure.mgmt.eventgrid.models.TopicSharedAccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -828,7 +843,6 @@ async def list_shared_access_keys(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -842,7 +856,7 @@ async def list_shared_access_keys(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response)
+ deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -855,8 +869,8 @@ async def _regenerate_key_initial(
topic_name: str,
regenerate_key_request: Union[_models.TopicRegenerateKeyRequest, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.TopicSharedAccessKeys]:
- error_map = {
+ ) -> AsyncIterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -869,7 +883,7 @@ async def _regenerate_key_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.TopicSharedAccessKeys]] = kwargs.pop("cls", None)
+ cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -890,10 +904,10 @@ async def _regenerate_key_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -901,17 +915,19 @@ async def _regenerate_key_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ await response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response)
-
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1024,10 +1040,11 @@ async def begin_regenerate_key(
params=_params,
**kwargs
)
+ await raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response)
+ deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -1081,7 +1098,7 @@ def list_event_types(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventTypesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1102,7 +1119,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1118,7 +1134,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_verified_partners_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_verified_partners_operations.py
index e3ba0d124170..ff0a8f443908 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_verified_partners_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/aio/operations/_verified_partners_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
@@ -19,17 +19,19 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import AsyncHttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
-from ..._vendor import _convert_request
from ...operations._verified_partners_operations import build_get_request, build_list_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -65,7 +67,7 @@ async def get(self, verified_partner_name: str, **kwargs: Any) -> _models.Verifi
:rtype: ~azure.mgmt.eventgrid.models.VerifiedPartner
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -85,7 +87,6 @@ async def get(self, verified_partner_name: str, **kwargs: Any) -> _models.Verifi
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -99,7 +100,7 @@ async def get(self, verified_partner_name: str, **kwargs: Any) -> _models.Verifi
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("VerifiedPartner", pipeline_response)
+ deserialized = self._deserialize("VerifiedPartner", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -136,7 +137,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.VerifiedPartnersListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -154,7 +155,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -170,7 +170,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/__init__.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/__init__.py
index 218970c101c9..70b207393533 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/__init__.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/__init__.py
@@ -5,281 +5,294 @@
# 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 AdvancedFilter
-from ._models_py3 import AzureADPartnerClientAuthentication
-from ._models_py3 import AzureFunctionEventSubscriptionDestination
-from ._models_py3 import BoolEqualsAdvancedFilter
-from ._models_py3 import BoolEqualsFilter
-from ._models_py3 import CaCertificate
-from ._models_py3 import CaCertificatesListResult
-from ._models_py3 import Channel
-from ._models_py3 import ChannelUpdateParameters
-from ._models_py3 import ChannelsListResult
-from ._models_py3 import Client
-from ._models_py3 import ClientAuthenticationSettings
-from ._models_py3 import ClientCertificateAuthentication
-from ._models_py3 import ClientGroup
-from ._models_py3 import ClientGroupsListResult
-from ._models_py3 import ClientsListResult
-from ._models_py3 import ConnectionState
-from ._models_py3 import CustomDomainConfiguration
-from ._models_py3 import CustomDomainIdentity
-from ._models_py3 import CustomDomainOwnershipValidationResult
-from ._models_py3 import CustomJwtAuthenticationManagedIdentity
-from ._models_py3 import CustomJwtAuthenticationSettings
-from ._models_py3 import DeadLetterDestination
-from ._models_py3 import DeadLetterWithResourceIdentity
-from ._models_py3 import DeliveryAttributeListResult
-from ._models_py3 import DeliveryAttributeMapping
-from ._models_py3 import DeliveryConfiguration
-from ._models_py3 import DeliveryWithResourceIdentity
-from ._models_py3 import Domain
-from ._models_py3 import DomainRegenerateKeyRequest
-from ._models_py3 import DomainSharedAccessKeys
-from ._models_py3 import DomainTopic
-from ._models_py3 import DomainTopicsListResult
-from ._models_py3 import DomainUpdateParameters
-from ._models_py3 import DomainsListResult
-from ._models_py3 import DynamicDeliveryAttributeMapping
-from ._models_py3 import DynamicRoutingEnrichment
-from ._models_py3 import ErrorAdditionalInfo
-from ._models_py3 import ErrorDetail
-from ._models_py3 import ErrorResponse
-from ._models_py3 import EventHubEventSubscriptionDestination
-from ._models_py3 import EventSubscription
-from ._models_py3 import EventSubscriptionDestination
-from ._models_py3 import EventSubscriptionFilter
-from ._models_py3 import EventSubscriptionFullUrl
-from ._models_py3 import EventSubscriptionIdentity
-from ._models_py3 import EventSubscriptionUpdateParameters
-from ._models_py3 import EventSubscriptionsListResult
-from ._models_py3 import EventType
-from ._models_py3 import EventTypeInfo
-from ._models_py3 import EventTypesListResult
-from ._models_py3 import ExtendedLocation
-from ._models_py3 import ExtensionTopic
-from ._models_py3 import Filter
-from ._models_py3 import FiltersConfiguration
-from ._models_py3 import HybridConnectionEventSubscriptionDestination
-from ._models_py3 import IdentityInfo
-from ._models_py3 import InboundIpRule
-from ._models_py3 import InlineEventProperties
-from ._models_py3 import InputSchemaMapping
-from ._models_py3 import IsNotNullAdvancedFilter
-from ._models_py3 import IsNotNullFilter
-from ._models_py3 import IsNullOrUndefinedAdvancedFilter
-from ._models_py3 import IsNullOrUndefinedFilter
-from ._models_py3 import IssuerCertificateInfo
-from ._models_py3 import JsonField
-from ._models_py3 import JsonFieldWithDefault
-from ._models_py3 import JsonInputSchemaMapping
-from ._models_py3 import MonitorAlertEventSubscriptionDestination
-from ._models_py3 import Namespace
-from ._models_py3 import NamespaceRegenerateKeyRequest
-from ._models_py3 import NamespaceSharedAccessKeys
-from ._models_py3 import NamespaceSku
-from ._models_py3 import NamespaceTopic
-from ._models_py3 import NamespaceTopicEventSubscriptionDestination
-from ._models_py3 import NamespaceTopicUpdateParameters
-from ._models_py3 import NamespaceTopicsListResult
-from ._models_py3 import NamespaceUpdateParameters
-from ._models_py3 import NamespacesListResult
-from ._models_py3 import NetworkSecurityPerimeterConfiguration
-from ._models_py3 import NetworkSecurityPerimeterConfigurationIssues
-from ._models_py3 import NetworkSecurityPerimeterConfigurationList
-from ._models_py3 import NetworkSecurityPerimeterConfigurationProfile
-from ._models_py3 import NetworkSecurityPerimeterInfo
-from ._models_py3 import NetworkSecurityPerimeterProfileAccessRule
-from ._models_py3 import NetworkSecurityPerimeterSubscription
-from ._models_py3 import NumberGreaterThanAdvancedFilter
-from ._models_py3 import NumberGreaterThanFilter
-from ._models_py3 import NumberGreaterThanOrEqualsAdvancedFilter
-from ._models_py3 import NumberGreaterThanOrEqualsFilter
-from ._models_py3 import NumberInAdvancedFilter
-from ._models_py3 import NumberInFilter
-from ._models_py3 import NumberInRangeAdvancedFilter
-from ._models_py3 import NumberInRangeFilter
-from ._models_py3 import NumberLessThanAdvancedFilter
-from ._models_py3 import NumberLessThanFilter
-from ._models_py3 import NumberLessThanOrEqualsAdvancedFilter
-from ._models_py3 import NumberLessThanOrEqualsFilter
-from ._models_py3 import NumberNotInAdvancedFilter
-from ._models_py3 import NumberNotInFilter
-from ._models_py3 import NumberNotInRangeAdvancedFilter
-from ._models_py3 import NumberNotInRangeFilter
-from ._models_py3 import Operation
-from ._models_py3 import OperationInfo
-from ._models_py3 import OperationsListResult
-from ._models_py3 import Partner
-from ._models_py3 import PartnerAuthorization
-from ._models_py3 import PartnerClientAuthentication
-from ._models_py3 import PartnerConfiguration
-from ._models_py3 import PartnerConfigurationUpdateParameters
-from ._models_py3 import PartnerConfigurationsListResult
-from ._models_py3 import PartnerDestination
-from ._models_py3 import PartnerDestinationInfo
-from ._models_py3 import PartnerDestinationUpdateParameters
-from ._models_py3 import PartnerDestinationsListResult
-from ._models_py3 import PartnerDetails
-from ._models_py3 import PartnerEventSubscriptionDestination
-from ._models_py3 import PartnerNamespace
-from ._models_py3 import PartnerNamespaceRegenerateKeyRequest
-from ._models_py3 import PartnerNamespaceSharedAccessKeys
-from ._models_py3 import PartnerNamespaceUpdateParameters
-from ._models_py3 import PartnerNamespacesListResult
-from ._models_py3 import PartnerRegistration
-from ._models_py3 import PartnerRegistrationUpdateParameters
-from ._models_py3 import PartnerRegistrationsListResult
-from ._models_py3 import PartnerTopic
-from ._models_py3 import PartnerTopicInfo
-from ._models_py3 import PartnerTopicUpdateParameters
-from ._models_py3 import PartnerTopicsListResult
-from ._models_py3 import PartnerUpdateDestinationInfo
-from ._models_py3 import PartnerUpdateTopicInfo
-from ._models_py3 import PermissionBinding
-from ._models_py3 import PermissionBindingsListResult
-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 PushInfo
-from ._models_py3 import QueueInfo
-from ._models_py3 import Resource
-from ._models_py3 import ResourceAssociation
-from ._models_py3 import ResourceMoveChangeHistory
-from ._models_py3 import ResourceSku
-from ._models_py3 import RetryPolicy
-from ._models_py3 import RoutingEnrichments
-from ._models_py3 import RoutingIdentityInfo
-from ._models_py3 import ServiceBusQueueEventSubscriptionDestination
-from ._models_py3 import ServiceBusTopicEventSubscriptionDestination
-from ._models_py3 import StaticDeliveryAttributeMapping
-from ._models_py3 import StaticRoutingEnrichment
-from ._models_py3 import StaticStringRoutingEnrichment
-from ._models_py3 import StorageBlobDeadLetterDestination
-from ._models_py3 import StorageQueueEventSubscriptionDestination
-from ._models_py3 import StringBeginsWithAdvancedFilter
-from ._models_py3 import StringBeginsWithFilter
-from ._models_py3 import StringContainsAdvancedFilter
-from ._models_py3 import StringContainsFilter
-from ._models_py3 import StringEndsWithAdvancedFilter
-from ._models_py3 import StringEndsWithFilter
-from ._models_py3 import StringInAdvancedFilter
-from ._models_py3 import StringInFilter
-from ._models_py3 import StringNotBeginsWithAdvancedFilter
-from ._models_py3 import StringNotBeginsWithFilter
-from ._models_py3 import StringNotContainsAdvancedFilter
-from ._models_py3 import StringNotContainsFilter
-from ._models_py3 import StringNotEndsWithAdvancedFilter
-from ._models_py3 import StringNotEndsWithFilter
-from ._models_py3 import StringNotInAdvancedFilter
-from ._models_py3 import StringNotInFilter
-from ._models_py3 import Subscription
-from ._models_py3 import SubscriptionFullUrl
-from ._models_py3 import SubscriptionUpdateParameters
-from ._models_py3 import SubscriptionsListResult
-from ._models_py3 import SystemData
-from ._models_py3 import SystemTopic
-from ._models_py3 import SystemTopicUpdateParameters
-from ._models_py3 import SystemTopicsListResult
-from ._models_py3 import Topic
-from ._models_py3 import TopicRegenerateKeyRequest
-from ._models_py3 import TopicSharedAccessKeys
-from ._models_py3 import TopicSpace
-from ._models_py3 import TopicSpacesConfiguration
-from ._models_py3 import TopicSpacesListResult
-from ._models_py3 import TopicTypeAdditionalEnforcedPermission
-from ._models_py3 import TopicTypeInfo
-from ._models_py3 import TopicTypesListResult
-from ._models_py3 import TopicUpdateParameters
-from ._models_py3 import TopicsConfiguration
-from ._models_py3 import TopicsListResult
-from ._models_py3 import TrackedResource
-from ._models_py3 import UpdateTopicSpacesConfigurationInfo
-from ._models_py3 import UpdateTopicsConfigurationInfo
-from ._models_py3 import UserIdentityProperties
-from ._models_py3 import VerifiedPartner
-from ._models_py3 import VerifiedPartnersListResult
-from ._models_py3 import WebHookEventSubscriptionDestination
-from ._models_py3 import WebhookPartnerDestinationInfo
-from ._models_py3 import WebhookUpdatePartnerDestinationInfo
+from typing import TYPE_CHECKING
-from ._event_grid_management_client_enums import AdvancedFilterOperatorType
-from ._event_grid_management_client_enums import AlternativeAuthenticationNameSource
-from ._event_grid_management_client_enums import CaCertificateProvisioningState
-from ._event_grid_management_client_enums import ChannelProvisioningState
-from ._event_grid_management_client_enums import ChannelType
-from ._event_grid_management_client_enums import ClientCertificateValidationScheme
-from ._event_grid_management_client_enums import ClientGroupProvisioningState
-from ._event_grid_management_client_enums import ClientProvisioningState
-from ._event_grid_management_client_enums import ClientState
-from ._event_grid_management_client_enums import CreatedByType
-from ._event_grid_management_client_enums import CustomDomainIdentityType
-from ._event_grid_management_client_enums import CustomDomainValidationState
-from ._event_grid_management_client_enums import CustomJwtAuthenticationManagedIdentityType
-from ._event_grid_management_client_enums import DataResidencyBoundary
-from ._event_grid_management_client_enums import DeadLetterEndPointType
-from ._event_grid_management_client_enums import DeliveryAttributeMappingType
-from ._event_grid_management_client_enums import DeliveryMode
-from ._event_grid_management_client_enums import DeliverySchema
-from ._event_grid_management_client_enums import DomainProvisioningState
-from ._event_grid_management_client_enums import DomainTopicProvisioningState
-from ._event_grid_management_client_enums import EndpointType
-from ._event_grid_management_client_enums import EventDefinitionKind
-from ._event_grid_management_client_enums import EventDeliverySchema
-from ._event_grid_management_client_enums import EventInputSchema
-from ._event_grid_management_client_enums import EventSubscriptionIdentityType
-from ._event_grid_management_client_enums import EventSubscriptionProvisioningState
-from ._event_grid_management_client_enums import FilterOperatorType
-from ._event_grid_management_client_enums import IdentityType
-from ._event_grid_management_client_enums import InputSchema
-from ._event_grid_management_client_enums import InputSchemaMappingType
-from ._event_grid_management_client_enums import IpActionType
-from ._event_grid_management_client_enums import MonitorAlertSeverity
-from ._event_grid_management_client_enums import NamespaceProvisioningState
-from ._event_grid_management_client_enums import NamespaceTopicProvisioningState
-from ._event_grid_management_client_enums import NetworkSecurityPerimeterAssociationAccessMode
-from ._event_grid_management_client_enums import NetworkSecurityPerimeterConfigProvisioningState
-from ._event_grid_management_client_enums import NetworkSecurityPerimeterConfigurationIssueSeverity
-from ._event_grid_management_client_enums import NetworkSecurityPerimeterConfigurationIssueType
-from ._event_grid_management_client_enums import NetworkSecurityPerimeterProfileAccessRuleDirection
-from ._event_grid_management_client_enums import NetworkSecurityPerimeterResourceType
-from ._event_grid_management_client_enums import PartnerClientAuthenticationType
-from ._event_grid_management_client_enums import PartnerConfigurationProvisioningState
-from ._event_grid_management_client_enums import PartnerDestinationActivationState
-from ._event_grid_management_client_enums import PartnerDestinationProvisioningState
-from ._event_grid_management_client_enums import PartnerEndpointType
-from ._event_grid_management_client_enums import PartnerNamespaceProvisioningState
-from ._event_grid_management_client_enums import PartnerRegistrationProvisioningState
-from ._event_grid_management_client_enums import PartnerTopicActivationState
-from ._event_grid_management_client_enums import PartnerTopicProvisioningState
-from ._event_grid_management_client_enums import PartnerTopicRoutingMode
-from ._event_grid_management_client_enums import PermissionBindingProvisioningState
-from ._event_grid_management_client_enums import PermissionType
-from ._event_grid_management_client_enums import PersistedConnectionStatus
-from ._event_grid_management_client_enums import PrivateEndpointConnectionsParentType
-from ._event_grid_management_client_enums import PublicNetworkAccess
-from ._event_grid_management_client_enums import PublisherType
-from ._event_grid_management_client_enums import ReadinessState
-from ._event_grid_management_client_enums import ResourceKind
-from ._event_grid_management_client_enums import ResourceProvisioningState
-from ._event_grid_management_client_enums import ResourceRegionType
-from ._event_grid_management_client_enums import RoutingIdentityType
-from ._event_grid_management_client_enums import Sku
-from ._event_grid_management_client_enums import SkuName
-from ._event_grid_management_client_enums import StaticRoutingEnrichmentType
-from ._event_grid_management_client_enums import SubscriptionProvisioningState
-from ._event_grid_management_client_enums import TlsVersion
-from ._event_grid_management_client_enums import TopicProvisioningState
-from ._event_grid_management_client_enums import TopicSpaceProvisioningState
-from ._event_grid_management_client_enums import TopicSpacesConfigurationState
-from ._event_grid_management_client_enums import TopicTypeProvisioningState
-from ._event_grid_management_client_enums import TopicTypeSourceScope
-from ._event_grid_management_client_enums import VerifiedPartnerProvisioningState
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+
+from ._models_py3 import ( # type: ignore
+ AdvancedFilter,
+ AzureADPartnerClientAuthentication,
+ AzureFunctionEventSubscriptionDestination,
+ BoolEqualsAdvancedFilter,
+ BoolEqualsFilter,
+ CaCertificate,
+ CaCertificatesListResult,
+ Channel,
+ ChannelUpdateParameters,
+ ChannelsListResult,
+ Client,
+ ClientAuthenticationSettings,
+ ClientCertificateAuthentication,
+ ClientGroup,
+ ClientGroupsListResult,
+ ClientsListResult,
+ ConnectionState,
+ CustomDomainConfiguration,
+ CustomDomainIdentity,
+ CustomDomainOwnershipValidationResult,
+ CustomJwtAuthenticationManagedIdentity,
+ CustomJwtAuthenticationSettings,
+ DeadLetterDestination,
+ DeadLetterWithResourceIdentity,
+ DeliveryAttributeListResult,
+ DeliveryAttributeMapping,
+ DeliveryConfiguration,
+ DeliveryWithResourceIdentity,
+ Domain,
+ DomainRegenerateKeyRequest,
+ DomainSharedAccessKeys,
+ DomainTopic,
+ DomainTopicsListResult,
+ DomainUpdateParameters,
+ DomainsListResult,
+ DynamicDeliveryAttributeMapping,
+ DynamicRoutingEnrichment,
+ EncodedIssuerCertificateInfo,
+ ErrorAdditionalInfo,
+ ErrorDetail,
+ ErrorResponse,
+ EventHubEventSubscriptionDestination,
+ EventSubscription,
+ EventSubscriptionDestination,
+ EventSubscriptionFilter,
+ EventSubscriptionFullUrl,
+ EventSubscriptionIdentity,
+ EventSubscriptionUpdateParameters,
+ EventSubscriptionsListResult,
+ EventType,
+ EventTypeInfo,
+ EventTypesListResult,
+ ExtendedLocation,
+ ExtensionTopic,
+ FederatedIdentityCredentialInfo,
+ Filter,
+ FiltersConfiguration,
+ HybridConnectionEventSubscriptionDestination,
+ IdentityInfo,
+ InboundIpRule,
+ InlineEventProperties,
+ InputSchemaMapping,
+ IsNotNullAdvancedFilter,
+ IsNotNullFilter,
+ IsNullOrUndefinedAdvancedFilter,
+ IsNullOrUndefinedFilter,
+ IssuerCertificateInfo,
+ JsonField,
+ JsonFieldWithDefault,
+ JsonInputSchemaMapping,
+ MonitorAlertEventSubscriptionDestination,
+ Namespace,
+ NamespaceRegenerateKeyRequest,
+ NamespaceSharedAccessKeys,
+ NamespaceSku,
+ NamespaceTopic,
+ NamespaceTopicEventSubscriptionDestination,
+ NamespaceTopicUpdateParameters,
+ NamespaceTopicsListResult,
+ NamespaceUpdateParameters,
+ NamespacesListResult,
+ NetworkSecurityPerimeterConfiguration,
+ NetworkSecurityPerimeterConfigurationIssues,
+ NetworkSecurityPerimeterConfigurationList,
+ NetworkSecurityPerimeterConfigurationProfile,
+ NetworkSecurityPerimeterInfo,
+ NetworkSecurityPerimeterProfileAccessRule,
+ NetworkSecurityPerimeterSubscription,
+ NumberGreaterThanAdvancedFilter,
+ NumberGreaterThanFilter,
+ NumberGreaterThanOrEqualsAdvancedFilter,
+ NumberGreaterThanOrEqualsFilter,
+ NumberInAdvancedFilter,
+ NumberInFilter,
+ NumberInRangeAdvancedFilter,
+ NumberInRangeFilter,
+ NumberLessThanAdvancedFilter,
+ NumberLessThanFilter,
+ NumberLessThanOrEqualsAdvancedFilter,
+ NumberLessThanOrEqualsFilter,
+ NumberNotInAdvancedFilter,
+ NumberNotInFilter,
+ NumberNotInRangeAdvancedFilter,
+ NumberNotInRangeFilter,
+ Operation,
+ OperationInfo,
+ OperationsListResult,
+ Partner,
+ PartnerAuthorization,
+ PartnerClientAuthentication,
+ PartnerConfiguration,
+ PartnerConfigurationUpdateParameters,
+ PartnerConfigurationsListResult,
+ PartnerDestination,
+ PartnerDestinationInfo,
+ PartnerDestinationUpdateParameters,
+ PartnerDestinationsListResult,
+ PartnerDetails,
+ PartnerEventSubscriptionDestination,
+ PartnerNamespace,
+ PartnerNamespaceRegenerateKeyRequest,
+ PartnerNamespaceSharedAccessKeys,
+ PartnerNamespaceUpdateParameters,
+ PartnerNamespacesListResult,
+ PartnerRegistration,
+ PartnerRegistrationUpdateParameters,
+ PartnerRegistrationsListResult,
+ PartnerTopic,
+ PartnerTopicInfo,
+ PartnerTopicUpdateParameters,
+ PartnerTopicsListResult,
+ PartnerUpdateDestinationInfo,
+ PartnerUpdateTopicInfo,
+ PermissionBinding,
+ PermissionBindingsListResult,
+ PrivateEndpoint,
+ PrivateEndpointConnection,
+ PrivateEndpointConnectionListResult,
+ PrivateLinkResource,
+ PrivateLinkResourcesListResult,
+ PushInfo,
+ QueueInfo,
+ Resource,
+ ResourceAssociation,
+ ResourceMoveChangeHistory,
+ ResourceSku,
+ RetryPolicy,
+ RoutingEnrichments,
+ RoutingIdentityInfo,
+ ServiceBusQueueEventSubscriptionDestination,
+ ServiceBusTopicEventSubscriptionDestination,
+ StaticDeliveryAttributeMapping,
+ StaticRoutingEnrichment,
+ StaticStringRoutingEnrichment,
+ StorageBlobDeadLetterDestination,
+ StorageQueueEventSubscriptionDestination,
+ StringBeginsWithAdvancedFilter,
+ StringBeginsWithFilter,
+ StringContainsAdvancedFilter,
+ StringContainsFilter,
+ StringEndsWithAdvancedFilter,
+ StringEndsWithFilter,
+ StringInAdvancedFilter,
+ StringInFilter,
+ StringNotBeginsWithAdvancedFilter,
+ StringNotBeginsWithFilter,
+ StringNotContainsAdvancedFilter,
+ StringNotContainsFilter,
+ StringNotEndsWithAdvancedFilter,
+ StringNotEndsWithFilter,
+ StringNotInAdvancedFilter,
+ StringNotInFilter,
+ Subscription,
+ SubscriptionFullUrl,
+ SubscriptionUpdateParameters,
+ SubscriptionsListResult,
+ SystemData,
+ SystemTopic,
+ SystemTopicUpdateParameters,
+ SystemTopicsListResult,
+ Topic,
+ TopicRegenerateKeyRequest,
+ TopicSharedAccessKeys,
+ TopicSpace,
+ TopicSpacesConfiguration,
+ TopicSpacesListResult,
+ TopicTypeAdditionalEnforcedPermission,
+ TopicTypeInfo,
+ TopicTypesListResult,
+ TopicUpdateParameters,
+ TopicsConfiguration,
+ TopicsListResult,
+ TrackedResource,
+ UpdateTopicSpacesConfigurationInfo,
+ UpdateTopicsConfigurationInfo,
+ UserIdentityProperties,
+ VerifiedPartner,
+ VerifiedPartnersListResult,
+ WebHookEventSubscriptionDestination,
+ WebhookPartnerDestinationInfo,
+ WebhookUpdatePartnerDestinationInfo,
+)
+
+from ._event_grid_management_client_enums import ( # type: ignore
+ AdvancedFilterOperatorType,
+ AlternativeAuthenticationNameSource,
+ CaCertificateProvisioningState,
+ ChannelProvisioningState,
+ ChannelType,
+ ClientCertificateValidationScheme,
+ ClientGroupProvisioningState,
+ ClientProvisioningState,
+ ClientState,
+ CreatedByType,
+ CustomDomainIdentityType,
+ CustomDomainValidationState,
+ CustomJwtAuthenticationManagedIdentityType,
+ DataResidencyBoundary,
+ DeadLetterEndPointType,
+ DeliveryAttributeMappingType,
+ DeliveryMode,
+ DeliverySchema,
+ DomainProvisioningState,
+ DomainTopicProvisioningState,
+ EndpointType,
+ EventDefinitionKind,
+ EventDeliverySchema,
+ EventInputSchema,
+ EventSubscriptionIdentityType,
+ EventSubscriptionProvisioningState,
+ FilterOperatorType,
+ IdentityType,
+ InputSchema,
+ InputSchemaMappingType,
+ IpActionType,
+ MonitorAlertSeverity,
+ NamespaceProvisioningState,
+ NamespaceTopicProvisioningState,
+ NetworkSecurityPerimeterAssociationAccessMode,
+ NetworkSecurityPerimeterConfigProvisioningState,
+ NetworkSecurityPerimeterConfigurationIssueSeverity,
+ NetworkSecurityPerimeterConfigurationIssueType,
+ NetworkSecurityPerimeterProfileAccessRuleDirection,
+ NetworkSecurityPerimeterResourceType,
+ PartnerClientAuthenticationType,
+ PartnerConfigurationProvisioningState,
+ PartnerDestinationActivationState,
+ PartnerDestinationProvisioningState,
+ PartnerEndpointType,
+ PartnerNamespaceProvisioningState,
+ PartnerRegistrationProvisioningState,
+ PartnerTopicActivationState,
+ PartnerTopicProvisioningState,
+ PartnerTopicRoutingMode,
+ PermissionBindingProvisioningState,
+ PermissionType,
+ PersistedConnectionStatus,
+ PrivateEndpointConnectionsParentType,
+ PublicNetworkAccess,
+ PublisherType,
+ ReadinessState,
+ ResourceKind,
+ ResourceProvisioningState,
+ ResourceRegionType,
+ RoutingIdentityType,
+ Sku,
+ SkuName,
+ StaticRoutingEnrichmentType,
+ SubscriptionProvisioningState,
+ TlsVersion,
+ TopicProvisioningState,
+ TopicSpaceProvisioningState,
+ TopicSpacesConfigurationState,
+ TopicTypeProvisioningState,
+ TopicTypeSourceScope,
+ VerifiedPartnerProvisioningState,
+)
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__ = [
@@ -320,6 +333,7 @@
"DomainsListResult",
"DynamicDeliveryAttributeMapping",
"DynamicRoutingEnrichment",
+ "EncodedIssuerCertificateInfo",
"ErrorAdditionalInfo",
"ErrorDetail",
"ErrorResponse",
@@ -336,6 +350,7 @@
"EventTypesListResult",
"ExtendedLocation",
"ExtensionTopic",
+ "FederatedIdentityCredentialInfo",
"Filter",
"FiltersConfiguration",
"HybridConnectionEventSubscriptionDestination",
@@ -555,5 +570,5 @@
"TopicTypeSourceScope",
"VerifiedPartnerProvisioningState",
]
-__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/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_models_py3.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_models_py3.py
index 18ca516aae10..5ebe0d458a9b 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/models/_models_py3.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/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
@@ -330,8 +329,8 @@ def __init__(self, *, key: Optional[str] = None, value: Optional[bool] = None, *
class Filter(_serialization.Model):
"""This is the base type that represents a filter. To configure a filter, do not directly
instantiate an object of this class. Instead, instantiate
- an object of a derived class such as BoolEqualsFilter, NumberInFilter, StringEqualsFilter etc
- depending on the type of the key based on
+ an object of a derived class such as BoolEqualsFilter, NumberInFilter etc depending on the type
+ of the key based on
which you want to filter.
You probably want to use the sub-classes and not this class directly. Known sub-classes are:
@@ -481,7 +480,7 @@ class CaCertificate(Resource):
:vartype name: str
:ivar type: Type of the resource.
:vartype type: str
- :ivar system_data: The system metadata relating to the CaCertificate resource.
+ :ivar system_data: The system metadata relating to the Event Grid resource.
:vartype system_data: ~azure.mgmt.eventgrid.models.SystemData
:ivar description: Description for the CA Certificate resource.
:vartype description: str
@@ -565,7 +564,7 @@ def __init__(
self.next_link = next_link
-class Channel(Resource): # pylint: disable=too-many-instance-attributes
+class Channel(Resource):
"""Channel info.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -576,7 +575,7 @@ class Channel(Resource): # pylint: disable=too-many-instance-attributes
:vartype name: str
:ivar type: Type of the resource.
:vartype type: str
- :ivar system_data: The system metadata relating to Channel resource.
+ :ivar system_data: The system metadata relating to the Event Grid resource.
:vartype system_data: ~azure.mgmt.eventgrid.models.SystemData
:ivar channel_type: The type of the event channel which represents the direction flow of
events. Known values are: "PartnerTopic" and "PartnerDestination".
@@ -769,7 +768,7 @@ class Client(Resource):
:vartype name: str
:ivar type: Type of the resource.
:vartype type: str
- :ivar system_data: The system metadata relating to the Client resource.
+ :ivar system_data: The system metadata relating to the Event Grid resource.
:vartype system_data: ~azure.mgmt.eventgrid.models.SystemData
:ivar description: Description for the Client resource.
:vartype description: str
@@ -947,7 +946,7 @@ class ClientGroup(Resource):
:vartype name: str
:ivar type: Type of the resource.
:vartype type: str
- :ivar system_data: The system metadata relating to the ClientGroup resource.
+ :ivar system_data: The system metadata relating to the Event Grid resource.
:vartype system_data: ~azure.mgmt.eventgrid.models.SystemData
:ivar description: Description for the Client Group resource.
:vartype description: str
@@ -1314,14 +1313,19 @@ class CustomJwtAuthenticationSettings(_serialization.Model):
:ivar token_issuer: Expected JWT token issuer.
:vartype token_issuer: str
- :ivar issuer_certificates: Information about the certificate that is used for token validation.
- We currently support maximum 2 certificates.
+ :ivar issuer_certificates: Information about the certificates that are used for token
+ validation. We currently support maximum 2 certificates.
:vartype issuer_certificates: list[~azure.mgmt.eventgrid.models.IssuerCertificateInfo]
+ :ivar encoded_issuer_certificates: Information about the encoded public certificates that are
+ used for custom authentication.
+ :vartype encoded_issuer_certificates:
+ list[~azure.mgmt.eventgrid.models.EncodedIssuerCertificateInfo]
"""
_attribute_map = {
"token_issuer": {"key": "tokenIssuer", "type": "str"},
"issuer_certificates": {"key": "issuerCertificates", "type": "[IssuerCertificateInfo]"},
+ "encoded_issuer_certificates": {"key": "encodedIssuerCertificates", "type": "[EncodedIssuerCertificateInfo]"},
}
def __init__(
@@ -1329,18 +1333,24 @@ def __init__(
*,
token_issuer: Optional[str] = None,
issuer_certificates: Optional[List["_models.IssuerCertificateInfo"]] = None,
+ encoded_issuer_certificates: Optional[List["_models.EncodedIssuerCertificateInfo"]] = None,
**kwargs: Any
) -> None:
"""
:keyword token_issuer: Expected JWT token issuer.
:paramtype token_issuer: str
- :keyword issuer_certificates: Information about the certificate that is used for token
+ :keyword issuer_certificates: Information about the certificates that are used for token
validation. We currently support maximum 2 certificates.
:paramtype issuer_certificates: list[~azure.mgmt.eventgrid.models.IssuerCertificateInfo]
+ :keyword encoded_issuer_certificates: Information about the encoded public certificates that
+ are used for custom authentication.
+ :paramtype encoded_issuer_certificates:
+ list[~azure.mgmt.eventgrid.models.EncodedIssuerCertificateInfo]
"""
super().__init__(**kwargs)
self.token_issuer = token_issuer
self.issuer_certificates = issuer_certificates
+ self.encoded_issuer_certificates = encoded_issuer_certificates
class DeadLetterDestination(_serialization.Model):
@@ -1598,7 +1608,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw
self.tags = tags
-class Domain(TrackedResource): # pylint: disable=too-many-instance-attributes
+class Domain(TrackedResource):
"""EventGrid Domain.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -1619,7 +1629,7 @@ class Domain(TrackedResource): # pylint: disable=too-many-instance-attributes
:vartype sku: ~azure.mgmt.eventgrid.models.ResourceSku
:ivar identity: Identity information for the Event Grid Domain resource.
:vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo
- :ivar system_data: The system metadata relating to the Event Grid Domain resource.
+ :ivar system_data: The system metadata relating to the Event Grid resource.
:vartype system_data: ~azure.mgmt.eventgrid.models.SystemData
:ivar private_endpoint_connections: List of private endpoint connections.
:vartype private_endpoint_connections:
@@ -1940,7 +1950,7 @@ class DomainTopic(Resource):
:vartype name: str
:ivar type: Type of the resource.
:vartype type: str
- :ivar system_data: The system metadata relating to Domain Topic resource.
+ :ivar system_data: The system metadata relating to the Event Grid resource.
:vartype system_data: ~azure.mgmt.eventgrid.models.SystemData
:ivar provisioning_state: Provisioning state of the domain topic. Known values are: "Creating",
"Updating", "Deleting", "Succeeded", "Canceled", and "Failed".
@@ -1998,7 +2008,7 @@ def __init__(
self.next_link = next_link
-class DomainUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes
+class DomainUpdateParameters(_serialization.Model):
"""Properties of the Domain update.
:ivar tags: Tags of the domains resource.
@@ -2231,6 +2241,39 @@ def __init__(self, *, key: Optional[str] = None, value: Optional[str] = None, **
self.value = value
+class EncodedIssuerCertificateInfo(_serialization.Model):
+ """Information about the public certificate that is used for custom authentication.
+
+ All required parameters must be populated in order to send to server.
+
+ :ivar kid: Identifier for the certificate. Required.
+ :vartype kid: str
+ :ivar encoded_certificate: Certificate in pem format. Required.
+ :vartype encoded_certificate: str
+ """
+
+ _validation = {
+ "kid": {"required": True},
+ "encoded_certificate": {"required": True},
+ }
+
+ _attribute_map = {
+ "kid": {"key": "kid", "type": "str"},
+ "encoded_certificate": {"key": "encodedCertificate", "type": "str"},
+ }
+
+ def __init__(self, *, kid: str, encoded_certificate: str, **kwargs: Any) -> None:
+ """
+ :keyword kid: Identifier for the certificate. Required.
+ :paramtype kid: str
+ :keyword encoded_certificate: Certificate in pem format. Required.
+ :paramtype encoded_certificate: str
+ """
+ super().__init__(**kwargs)
+ self.kid = kid
+ self.encoded_certificate = encoded_certificate
+
+
class ErrorAdditionalInfo(_serialization.Model):
"""The resource management error additional info.
@@ -2374,7 +2417,7 @@ def __init__(
self.delivery_attribute_mappings = delivery_attribute_mappings
-class EventSubscription(Resource): # pylint: disable=too-many-instance-attributes
+class EventSubscription(Resource):
"""Event Subscription.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -2385,7 +2428,7 @@ class EventSubscription(Resource): # pylint: disable=too-many-instance-attribut
:vartype name: str
:ivar type: Type of the resource.
:vartype type: str
- :ivar system_data: The system metadata relating to Event Subscription resource.
+ :ivar system_data: The system metadata relating to the Event Grid resource.
:vartype system_data: ~azure.mgmt.eventgrid.models.SystemData
:ivar topic: Name of the topic of the event subscription.
:vartype topic: str
@@ -2642,11 +2685,19 @@ class EventSubscriptionIdentity(_serialization.Model):
:vartype type: str or ~azure.mgmt.eventgrid.models.EventSubscriptionIdentityType
:ivar user_assigned_identity: The user identity associated with the resource.
:vartype user_assigned_identity: str
+ :ivar federated_identity_credential_info: The details of the Federated Identity Credential
+ (FIC) used with the resource delivery.
+ :vartype federated_identity_credential_info:
+ ~azure.mgmt.eventgrid.models.FederatedIdentityCredentialInfo
"""
_attribute_map = {
"type": {"key": "type", "type": "str"},
"user_assigned_identity": {"key": "userAssignedIdentity", "type": "str"},
+ "federated_identity_credential_info": {
+ "key": "federatedIdentityCredentialInfo",
+ "type": "FederatedIdentityCredentialInfo",
+ },
}
def __init__(
@@ -2654,6 +2705,7 @@ def __init__(
*,
type: Optional[Union[str, "_models.EventSubscriptionIdentityType"]] = None,
user_assigned_identity: Optional[str] = None,
+ federated_identity_credential_info: Optional["_models.FederatedIdentityCredentialInfo"] = None,
**kwargs: Any
) -> None:
"""
@@ -2662,10 +2714,15 @@ def __init__(
:paramtype type: str or ~azure.mgmt.eventgrid.models.EventSubscriptionIdentityType
:keyword user_assigned_identity: The user identity associated with the resource.
:paramtype user_assigned_identity: str
+ :keyword federated_identity_credential_info: The details of the Federated Identity Credential
+ (FIC) used with the resource delivery.
+ :paramtype federated_identity_credential_info:
+ ~azure.mgmt.eventgrid.models.FederatedIdentityCredentialInfo
"""
super().__init__(**kwargs)
self.type = type
self.user_assigned_identity = user_assigned_identity
+ self.federated_identity_credential_info = federated_identity_credential_info
class EventSubscriptionsListResult(_serialization.Model):
@@ -2836,7 +2893,7 @@ class EventType(Resource):
:vartype display_name: str
:ivar description: Description of the event type.
:vartype description: str
- :ivar schema_url: Url of the schema for this event type.
+ :ivar schema_url: URL of the schema for this event type.
:vartype schema_url: str
:ivar is_in_default_set: IsInDefaultSet flag of the event type.
:vartype is_in_default_set: bool
@@ -2872,7 +2929,7 @@ def __init__(
:paramtype display_name: str
:keyword description: Description of the event type.
:paramtype description: str
- :keyword schema_url: Url of the schema for this event type.
+ :keyword schema_url: URL of the schema for this event type.
:paramtype schema_url: str
:keyword is_in_default_set: IsInDefaultSet flag of the event type.
:paramtype is_in_default_set: bool
@@ -2982,7 +3039,7 @@ class ExtensionTopic(Resource):
:vartype name: str
:ivar type: Type of the resource.
:vartype type: str
- :ivar system_data: The system metadata relating to Extension Topic resource.
+ :ivar system_data: The system metadata relating to the Event Grid resource.
:vartype system_data: ~azure.mgmt.eventgrid.models.SystemData
:ivar description: Description of the extension topic.
:vartype description: str
@@ -3019,6 +3076,34 @@ def __init__(self, *, description: Optional[str] = None, system_topic: Optional[
self.system_topic = system_topic
+class FederatedIdentityCredentialInfo(_serialization.Model):
+ """The details of the Federated Identity Credential (FIC) used with the resource.
+
+ All required parameters must be populated in order to send to server.
+
+ :ivar federated_client_id: The Multi-Tenant AAD Application where the Federated Identity
+ Credential (FIC) is associated with. Required.
+ :vartype federated_client_id: str
+ """
+
+ _validation = {
+ "federated_client_id": {"required": True},
+ }
+
+ _attribute_map = {
+ "federated_client_id": {"key": "federatedClientId", "type": "str"},
+ }
+
+ def __init__(self, *, federated_client_id: str, **kwargs: Any) -> None:
+ """
+ :keyword federated_client_id: The Multi-Tenant AAD Application where the Federated Identity
+ Credential (FIC) is associated with. Required.
+ :paramtype federated_client_id: str
+ """
+ super().__init__(**kwargs)
+ self.federated_client_id = federated_client_id
+
+
class FiltersConfiguration(_serialization.Model):
"""Filters configuration for the Event Subscription.
@@ -3650,7 +3735,7 @@ def __init__(
self.action_groups = action_groups
-class Namespace(TrackedResource): # pylint: disable=too-many-instance-attributes
+class Namespace(TrackedResource):
"""Namespace resource.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -3671,7 +3756,7 @@ class Namespace(TrackedResource): # pylint: disable=too-many-instance-attribute
:vartype sku: ~azure.mgmt.eventgrid.models.NamespaceSku
:ivar identity: Identity information for the Namespace resource.
:vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo
- :ivar system_data: The system metadata relating to the namespace resource.
+ :ivar system_data: The system metadata relating to the Event Grid resource.
:vartype system_data: ~azure.mgmt.eventgrid.models.SystemData
:ivar private_endpoint_connections: List of private endpoint connections.
:vartype private_endpoint_connections:
@@ -3689,8 +3774,8 @@ class Namespace(TrackedResource): # pylint: disable=too-many-instance-attribute
namespace resource supports zone-redundancy capability or not. If this
property is not specified explicitly by the user, its default value depends on the following
conditions:
- a. For Availability Zones enabled regions - The default property value would be true.
- b. For non-Availability Zones enabled regions - The default property value would be false.
+ a. For Availability Zones enabled regions - The default property value would be true.
+ b. For non-Availability Zones enabled regions - The default property value would be false.
Once specified, this property cannot be updated.
:vartype is_zone_redundant: bool
:ivar public_network_access: This determines if traffic is allowed over public network. By
@@ -3778,8 +3863,8 @@ def __init__(
the namespace resource supports zone-redundancy capability or not. If this
property is not specified explicitly by the user, its default value depends on the following
conditions:
- a. For Availability Zones enabled regions - The default property value would be true.
- b. For non-Availability Zones enabled regions - The default property value would be false.
+ a. For Availability Zones enabled regions - The default property value would be true.
+ b. For non-Availability Zones enabled regions - The default property value would be false.
Once specified, this property cannot be updated.
:paramtype is_zone_redundant: bool
:keyword public_network_access: This determines if traffic is allowed over public network. By
@@ -3937,7 +4022,7 @@ class NamespaceTopic(Resource):
:vartype name: str
:ivar type: Type of the resource.
:vartype type: str
- :ivar system_data: The system metadata relating to namespace topic resource.
+ :ivar system_data: The system metadata relating to the Event Grid resource.
:vartype system_data: ~azure.mgmt.eventgrid.models.SystemData
:ivar provisioning_state: Provisioning state of the namespace topic. Known values are:
"Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed", "Deleted",
@@ -5438,7 +5523,7 @@ class PartnerConfiguration(Resource):
:vartype name: str
:ivar type: Type of the resource.
:vartype type: str
- :ivar system_data: The system metadata relating to partner configuration resource.
+ :ivar system_data: The system metadata relating to the Event Grid resource.
:vartype system_data: ~azure.mgmt.eventgrid.models.SystemData
:ivar location: Location of the resource.
:vartype location: str
@@ -5568,7 +5653,7 @@ def __init__(
self.default_maximum_expiration_time_in_days = default_maximum_expiration_time_in_days
-class PartnerDestination(TrackedResource): # pylint: disable=too-many-instance-attributes
+class PartnerDestination(TrackedResource):
"""Event Grid Partner Destination.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -5585,7 +5670,7 @@ class PartnerDestination(TrackedResource): # pylint: disable=too-many-instance-
:vartype location: str
:ivar tags: Tags of the resource.
:vartype tags: dict[str, str]
- :ivar system_data: The system metadata relating to Partner Destination resource.
+ :ivar system_data: The system metadata relating to the Event Grid resource.
:vartype system_data: ~azure.mgmt.eventgrid.models.SystemData
:ivar partner_registration_immutable_id: The immutable Id of the corresponding partner
registration.
@@ -5899,7 +5984,7 @@ def __init__(self, *, resource_id: Optional[str] = None, **kwargs: Any) -> None:
self.resource_id = resource_id
-class PartnerNamespace(TrackedResource): # pylint: disable=too-many-instance-attributes
+class PartnerNamespace(TrackedResource):
"""EventGrid Partner Namespace.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -5916,7 +6001,7 @@ class PartnerNamespace(TrackedResource): # pylint: disable=too-many-instance-at
:vartype location: str
:ivar tags: Tags of the resource.
:vartype tags: dict[str, str]
- :ivar system_data: The system metadata relating to Partner Namespace resource.
+ :ivar system_data: The system metadata relating to the Event Grid resource.
:vartype system_data: ~azure.mgmt.eventgrid.models.SystemData
:ivar private_endpoint_connections: List of private endpoint connections.
:vartype private_endpoint_connections:
@@ -6222,7 +6307,7 @@ class PartnerRegistration(TrackedResource):
:vartype location: str
:ivar tags: Tags of the resource.
:vartype tags: dict[str, str]
- :ivar system_data: The system metadata relating to Partner Registration resource.
+ :ivar system_data: The system metadata relating to the Event Grid resource.
:vartype system_data: ~azure.mgmt.eventgrid.models.SystemData
:ivar provisioning_state: Provisioning state of the partner registration. Known values are:
"Creating", "Updating", "Deleting", "Succeeded", "Canceled", and "Failed".
@@ -6332,7 +6417,7 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> N
self.tags = tags
-class PartnerTopic(TrackedResource): # pylint: disable=too-many-instance-attributes
+class PartnerTopic(TrackedResource):
"""Event Grid Partner Topic.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -6349,7 +6434,7 @@ class PartnerTopic(TrackedResource): # pylint: disable=too-many-instance-attrib
:vartype location: str
:ivar tags: Tags of the resource.
:vartype tags: dict[str, str]
- :ivar system_data: The system metadata relating to Partner Topic resource.
+ :ivar system_data: The system metadata relating to the Event Grid resource.
:vartype system_data: ~azure.mgmt.eventgrid.models.SystemData
:ivar identity: Identity information for the Partner Topic resource.
:vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo
@@ -6659,7 +6744,7 @@ class PermissionBinding(Resource):
:vartype name: str
:ivar type: Type of the resource.
:vartype type: str
- :ivar system_data: The system metadata relating to the PermissionBinding resource.
+ :ivar system_data: The system metadata relating to the Event Grid resource.
:vartype system_data: ~azure.mgmt.eventgrid.models.SystemData
:ivar description: Description for the Permission Binding resource.
:vartype description: str
@@ -6991,7 +7076,7 @@ class PushInfo(_serialization.Model):
:vartype max_delivery_count: int
:ivar event_time_to_live: Time span duration in ISO 8601 format that determines how long
messages are available to the subscription from the time the message was published.
- This duration value is expressed using the following format: \'P(n)Y(n)M(n)DT(n)H(n)M(n)S\',
+ This duration value is expressed using the following format: \\'P(n)Y(n)M(n)DT(n)H(n)M(n)S\\',
where:
.. code-block::
@@ -7014,8 +7099,8 @@ class PushInfo(_serialization.Model):
.. code-block::
- - \'P0DT23H12M\' or \'PT23H12M\': for duration of 23 hours and 12 minutes.
- - \'P1D\' or \'P1DT0H0M0S\': for duration of 1 day.
+ - \\'P0DT23H12M\\' or \\'PT23H12M\\': for duration of 23 hours and 12 minutes.
+ - \\'P1D\\' or \\'P1DT0H0M0S\\': for duration of 1 day.
:vartype event_time_to_live: str
:ivar dead_letter_destination_with_resource_identity: The dead letter destination of the event
subscription. Any event that cannot be delivered to its' destination is sent to the dead letter
@@ -7066,7 +7151,7 @@ def __init__(
:paramtype max_delivery_count: int
:keyword event_time_to_live: Time span duration in ISO 8601 format that determines how long
messages are available to the subscription from the time the message was published.
- This duration value is expressed using the following format: \'P(n)Y(n)M(n)DT(n)H(n)M(n)S\',
+ This duration value is expressed using the following format: \\'P(n)Y(n)M(n)DT(n)H(n)M(n)S\\',
where:
.. code-block::
@@ -7089,8 +7174,8 @@ def __init__(
.. code-block::
- - \'P0DT23H12M\' or \'PT23H12M\': for duration of 23 hours and 12 minutes.
- - \'P1D\' or \'P1DT0H0M0S\': for duration of 1 day.
+ - \\'P0DT23H12M\\' or \\'PT23H12M\\': for duration of 23 hours and 12 minutes.
+ - \\'P1D\\' or \\'P1DT0H0M0S\\': for duration of 1 day.
:paramtype event_time_to_live: str
:keyword dead_letter_destination_with_resource_identity: The dead letter destination of the
event subscription. Any event that cannot be delivered to its' destination is sent to the dead
@@ -7140,7 +7225,7 @@ class QueueInfo(_serialization.Model):
~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity
:ivar event_time_to_live: Time span duration in ISO 8601 format that determines how long
messages are available to the subscription from the time the message was published.
- This duration value is expressed using the following format: \'P(n)Y(n)M(n)DT(n)H(n)M(n)S\',
+ This duration value is expressed using the following format: \\'P(n)Y(n)M(n)DT(n)H(n)M(n)S\\',
where:
.. code-block::
@@ -7163,8 +7248,8 @@ class QueueInfo(_serialization.Model):
.. code-block::
- - \'P0DT23H12M\' or \'PT23H12M\': for duration of 23 hours and 12 minutes.
- - \'P1D\' or \'P1DT0H0M0S\': for duration of 1 day.
+ - \\'P0DT23H12M\\' or \\'PT23H12M\\': for duration of 23 hours and 12 minutes.
+ - \\'P1D\\' or \\'P1DT0H0M0S\\': for duration of 1 day.
:vartype event_time_to_live: ~datetime.timedelta
"""
@@ -7206,7 +7291,7 @@ def __init__(
~azure.mgmt.eventgrid.models.DeadLetterWithResourceIdentity
:keyword event_time_to_live: Time span duration in ISO 8601 format that determines how long
messages are available to the subscription from the time the message was published.
- This duration value is expressed using the following format: \'P(n)Y(n)M(n)DT(n)H(n)M(n)S\',
+ This duration value is expressed using the following format: \\'P(n)Y(n)M(n)DT(n)H(n)M(n)S\\',
where:
.. code-block::
@@ -7229,8 +7314,8 @@ def __init__(
.. code-block::
- - \'P0DT23H12M\' or \'PT23H12M\': for duration of 23 hours and 12 minutes.
- - \'P1D\' or \'P1DT0H0M0S\': for duration of 1 day.
+ - \\'P0DT23H12M\\' or \\'PT23H12M\\': for duration of 23 hours and 12 minutes.
+ - \\'P1D\\' or \\'P1DT0H0M0S\\': for duration of 1 day.
:paramtype event_time_to_live: ~datetime.timedelta
"""
super().__init__(**kwargs)
@@ -8402,7 +8487,7 @@ class Subscription(Resource):
:vartype name: str
:ivar type: Type of the resource.
:vartype type: str
- :ivar system_data: The system metadata relating to Event Subscription resource.
+ :ivar system_data: The system metadata relating to the Event Grid resource.
:vartype system_data: ~azure.mgmt.eventgrid.models.SystemData
:ivar provisioning_state: Provisioning state of the event subscription. Known values are:
"Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed", "AwaitingManualAction",
@@ -8418,6 +8503,8 @@ class Subscription(Resource):
:vartype filters_configuration: ~azure.mgmt.eventgrid.models.FiltersConfiguration
:ivar expiration_time_utc: Expiration time of the event subscription.
:vartype expiration_time_utc: ~datetime.datetime
+ :ivar tags: Tags relating to Event Subscription resource.
+ :vartype tags: dict[str, str]
"""
_validation = {
@@ -8438,6 +8525,7 @@ class Subscription(Resource):
"event_delivery_schema": {"key": "properties.eventDeliverySchema", "type": "str"},
"filters_configuration": {"key": "properties.filtersConfiguration", "type": "FiltersConfiguration"},
"expiration_time_utc": {"key": "properties.expirationTimeUtc", "type": "iso-8601"},
+ "tags": {"key": "properties.tags", "type": "{str}"},
}
def __init__(
@@ -8447,6 +8535,7 @@ def __init__(
event_delivery_schema: Optional[Union[str, "_models.DeliverySchema"]] = None,
filters_configuration: Optional["_models.FiltersConfiguration"] = None,
expiration_time_utc: Optional[datetime.datetime] = None,
+ tags: Optional[Dict[str, str]] = None,
**kwargs: Any
) -> None:
"""
@@ -8460,6 +8549,8 @@ def __init__(
:paramtype filters_configuration: ~azure.mgmt.eventgrid.models.FiltersConfiguration
:keyword expiration_time_utc: Expiration time of the event subscription.
:paramtype expiration_time_utc: ~datetime.datetime
+ :keyword tags: Tags relating to Event Subscription resource.
+ :paramtype tags: dict[str, str]
"""
super().__init__(**kwargs)
self.system_data = None
@@ -8468,6 +8559,7 @@ def __init__(
self.event_delivery_schema = event_delivery_schema
self.filters_configuration = filters_configuration
self.expiration_time_utc = expiration_time_utc
+ self.tags = tags
class SubscriptionFullUrl(_serialization.Model):
@@ -8533,6 +8625,8 @@ class SubscriptionUpdateParameters(_serialization.Model):
:vartype filters_configuration: ~azure.mgmt.eventgrid.models.FiltersConfiguration
:ivar expiration_time_utc: Expiration time of the event subscription.
:vartype expiration_time_utc: ~datetime.datetime
+ :ivar tags: Tags relating to Event Subscription resource.
+ :vartype tags: dict[str, str]
"""
_attribute_map = {
@@ -8540,6 +8634,7 @@ class SubscriptionUpdateParameters(_serialization.Model):
"event_delivery_schema": {"key": "properties.eventDeliverySchema", "type": "str"},
"filters_configuration": {"key": "properties.filtersConfiguration", "type": "FiltersConfiguration"},
"expiration_time_utc": {"key": "properties.expirationTimeUtc", "type": "iso-8601"},
+ "tags": {"key": "properties.tags", "type": "{str}"},
}
def __init__(
@@ -8549,6 +8644,7 @@ def __init__(
event_delivery_schema: Optional[Union[str, "_models.DeliverySchema"]] = None,
filters_configuration: Optional["_models.FiltersConfiguration"] = None,
expiration_time_utc: Optional[datetime.datetime] = None,
+ tags: Optional[Dict[str, str]] = None,
**kwargs: Any
) -> None:
"""
@@ -8562,12 +8658,15 @@ def __init__(
:paramtype filters_configuration: ~azure.mgmt.eventgrid.models.FiltersConfiguration
:keyword expiration_time_utc: Expiration time of the event subscription.
:paramtype expiration_time_utc: ~datetime.datetime
+ :keyword tags: Tags relating to Event Subscription resource.
+ :paramtype tags: dict[str, str]
"""
super().__init__(**kwargs)
self.delivery_configuration = delivery_configuration
self.event_delivery_schema = event_delivery_schema
self.filters_configuration = filters_configuration
self.expiration_time_utc = expiration_time_utc
+ self.tags = tags
class SystemData(_serialization.Model):
@@ -8634,7 +8733,7 @@ def __init__(
self.last_modified_at = last_modified_at
-class SystemTopic(TrackedResource): # pylint: disable=too-many-instance-attributes
+class SystemTopic(TrackedResource):
"""EventGrid System Topic.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -8651,7 +8750,7 @@ class SystemTopic(TrackedResource): # pylint: disable=too-many-instance-attribu
:vartype location: str
:ivar tags: Tags of the resource.
:vartype tags: dict[str, str]
- :ivar system_data: The system metadata relating to System Topic resource.
+ :ivar system_data: The system metadata relating to the Event Grid resource.
:vartype system_data: ~azure.mgmt.eventgrid.models.SystemData
:ivar identity: Identity information for the resource.
:vartype identity: ~azure.mgmt.eventgrid.models.IdentityInfo
@@ -8777,7 +8876,7 @@ def __init__(
self.identity = identity
-class Topic(TrackedResource): # pylint: disable=too-many-instance-attributes
+class Topic(TrackedResource):
"""EventGrid Topic.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -8802,7 +8901,7 @@ class Topic(TrackedResource): # pylint: disable=too-many-instance-attributes
:vartype kind: str or ~azure.mgmt.eventgrid.models.ResourceKind
:ivar extended_location: Extended location of the resource.
:vartype extended_location: ~azure.mgmt.eventgrid.models.ExtendedLocation
- :ivar system_data: The system metadata relating to Topic resource.
+ :ivar system_data: The system metadata relating to the Event Grid resource.
:vartype system_data: ~azure.mgmt.eventgrid.models.SystemData
:ivar private_endpoint_connections: List of private endpoint connections.
:vartype private_endpoint_connections:
@@ -9094,15 +9193,15 @@ class TopicSpace(Resource):
:vartype name: str
:ivar type: Type of the resource.
:vartype type: str
- :ivar system_data: The system metadata relating to the TopicSpace resource.
+ :ivar system_data: The system metadata relating to the Event Grid resource.
:vartype system_data: ~azure.mgmt.eventgrid.models.SystemData
:ivar description: Description for the Topic Space resource.
:vartype description: str
:ivar topic_templates: The topic filters in the topic space.
Example: "topicTemplates": [
- "devices/foo/bar",
- "devices/topic1/+",
- "devices/${principal.name}/${principal.attributes.keyName}" ].
+ "devices/foo/bar",
+ "devices/topic1/+",
+ "devices/${principal.name}/${principal.attributes.keyName}" ].
:vartype topic_templates: list[str]
:ivar provisioning_state: Provisioning state of the TopicSpace resource. Known values are:
"Creating", "Updating", "Deleting", "Succeeded", "Canceled", "Failed", and "Deleted".
@@ -9135,9 +9234,9 @@ def __init__(
:paramtype description: str
:keyword topic_templates: The topic filters in the topic space.
Example: "topicTemplates": [
- "devices/foo/bar",
- "devices/topic1/+",
- "devices/${principal.name}/${principal.attributes.keyName}" ].
+ "devices/foo/bar",
+ "devices/topic1/+",
+ "devices/${principal.name}/${principal.attributes.keyName}" ].
:paramtype topic_templates: list[str]
"""
super().__init__(**kwargs)
@@ -9308,7 +9407,7 @@ def __init__(
self.is_data_action = is_data_action
-class TopicTypeInfo(Resource): # pylint: disable=too-many-instance-attributes
+class TopicTypeInfo(Resource):
"""Properties of a topic type info.
Variables are only populated by the server, and will be ignored when sending a request.
@@ -9698,7 +9797,7 @@ class VerifiedPartner(Resource):
:vartype name: str
:ivar type: Type of the resource.
:vartype type: str
- :ivar system_data: The system metadata relating to Verified Partner resource.
+ :ivar system_data: The system metadata relating to the Event Grid resource.
:vartype system_data: ~azure.mgmt.eventgrid.models.SystemData
:ivar partner_registration_immutable_id: ImmutableId of the corresponding partner registration.
:vartype partner_registration_immutable_id: str
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/__init__.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/__init__.py
index a245f48233e3..9a0d2f8ebe67 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/__init__.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/__init__.py
@@ -5,41 +5,47 @@
# 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 ._ca_certificates_operations import CaCertificatesOperations
-from ._channels_operations import ChannelsOperations
-from ._client_groups_operations import ClientGroupsOperations
-from ._clients_operations import ClientsOperations
-from ._domains_operations import DomainsOperations
-from ._domain_topics_operations import DomainTopicsOperations
-from ._domain_topic_event_subscriptions_operations import DomainTopicEventSubscriptionsOperations
-from ._topic_event_subscriptions_operations import TopicEventSubscriptionsOperations
-from ._domain_event_subscriptions_operations import DomainEventSubscriptionsOperations
-from ._event_subscriptions_operations import EventSubscriptionsOperations
-from ._system_topic_event_subscriptions_operations import SystemTopicEventSubscriptionsOperations
-from ._namespace_topic_event_subscriptions_operations import NamespaceTopicEventSubscriptionsOperations
-from ._partner_topic_event_subscriptions_operations import PartnerTopicEventSubscriptionsOperations
-from ._namespaces_operations import NamespacesOperations
-from ._namespace_topics_operations import NamespaceTopicsOperations
-from ._operations import Operations
-from ._partner_configurations_operations import PartnerConfigurationsOperations
-from ._partner_destinations_operations import PartnerDestinationsOperations
-from ._partner_namespaces_operations import PartnerNamespacesOperations
-from ._partner_registrations_operations import PartnerRegistrationsOperations
-from ._partner_topics_operations import PartnerTopicsOperations
-from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations
-from ._permission_bindings_operations import PermissionBindingsOperations
-from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
-from ._private_link_resources_operations import PrivateLinkResourcesOperations
-from ._system_topics_operations import SystemTopicsOperations
-from ._topics_operations import TopicsOperations
-from ._extension_topics_operations import ExtensionTopicsOperations
-from ._topic_spaces_operations import TopicSpacesOperations
-from ._topic_types_operations import TopicTypesOperations
-from ._verified_partners_operations import VerifiedPartnersOperations
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from ._patch import * # pylint: disable=unused-wildcard-import
+
+from ._ca_certificates_operations import CaCertificatesOperations # type: ignore
+from ._channels_operations import ChannelsOperations # type: ignore
+from ._client_groups_operations import ClientGroupsOperations # type: ignore
+from ._clients_operations import ClientsOperations # type: ignore
+from ._domains_operations import DomainsOperations # type: ignore
+from ._domain_topics_operations import DomainTopicsOperations # type: ignore
+from ._domain_topic_event_subscriptions_operations import DomainTopicEventSubscriptionsOperations # type: ignore
+from ._topic_event_subscriptions_operations import TopicEventSubscriptionsOperations # type: ignore
+from ._domain_event_subscriptions_operations import DomainEventSubscriptionsOperations # type: ignore
+from ._event_subscriptions_operations import EventSubscriptionsOperations # type: ignore
+from ._system_topic_event_subscriptions_operations import SystemTopicEventSubscriptionsOperations # type: ignore
+from ._namespace_topic_event_subscriptions_operations import NamespaceTopicEventSubscriptionsOperations # type: ignore
+from ._partner_topic_event_subscriptions_operations import PartnerTopicEventSubscriptionsOperations # type: ignore
+from ._namespaces_operations import NamespacesOperations # type: ignore
+from ._namespace_topics_operations import NamespaceTopicsOperations # type: ignore
+from ._operations import Operations # type: ignore
+from ._partner_configurations_operations import PartnerConfigurationsOperations # type: ignore
+from ._partner_destinations_operations import PartnerDestinationsOperations # type: ignore
+from ._partner_namespaces_operations import PartnerNamespacesOperations # type: ignore
+from ._partner_registrations_operations import PartnerRegistrationsOperations # type: ignore
+from ._partner_topics_operations import PartnerTopicsOperations # type: ignore
+from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore
+from ._permission_bindings_operations import PermissionBindingsOperations # type: ignore
+from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore
+from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore
+from ._system_topics_operations import SystemTopicsOperations # type: ignore
+from ._topics_operations import TopicsOperations # type: ignore
+from ._extension_topics_operations import ExtensionTopicsOperations # type: ignore
+from ._topic_spaces_operations import TopicSpacesOperations # type: ignore
+from ._topic_types_operations import TopicTypesOperations # type: ignore
+from ._verified_partners_operations import VerifiedPartnersOperations # 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__ = [
@@ -75,5 +81,5 @@
"TopicTypesOperations",
"VerifiedPartnersOperations",
]
-__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/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_ca_certificates_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_ca_certificates_operations.py
index 1c744445662a..12f65be0df8a 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_ca_certificates_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_ca_certificates_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,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +16,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +31,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +49,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -81,7 +85,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -120,7 +124,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -162,7 +166,7 @@ def build_list_by_namespace_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -231,7 +235,7 @@ def get(
:rtype: ~azure.mgmt.eventgrid.models.CaCertificate
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -254,7 +258,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -269,7 +272,7 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("CaCertificate", pipeline_response)
+ deserialized = self._deserialize("CaCertificate", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -283,8 +286,8 @@ def _create_or_update_initial(
ca_certificate_name: str,
ca_certificate_info: Union[_models.CaCertificate, IO[bytes]],
**kwargs: Any
- ) -> _models.CaCertificate:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -297,7 +300,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.CaCertificate] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -319,10 +322,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -330,15 +333,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ 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 = self._deserialize("CaCertificate", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("CaCertificate", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -461,10 +464,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("CaCertificate", pipeline_response)
+ deserialized = self._deserialize("CaCertificate", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -488,10 +492,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self, resource_group_name: str, namespace_name: str, ca_certificate_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -503,7 +507,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -514,10 +518,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -525,6 +529,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -533,8 +541,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -564,7 +576,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
namespace_name=namespace_name,
ca_certificate_name=ca_certificate_name,
@@ -574,6 +586,7 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -637,7 +650,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CaCertificatesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -658,7 +671,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -674,7 +686,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_channels_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_channels_operations.py
index 0d92aa9952e2..79789d8ee57f 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_channels_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_channels_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,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +16,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +31,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +49,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -77,7 +81,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -111,7 +115,7 @@ def build_delete_request(
) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
# Construct URL
_url = kwargs.pop(
"template_url",
@@ -138,7 +142,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
# Construct URL
_url = kwargs.pop(
@@ -176,7 +180,7 @@ def build_list_by_partner_namespace_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -211,7 +215,7 @@ def build_get_full_url_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -275,7 +279,7 @@ def get(
:rtype: ~azure.mgmt.eventgrid.models.Channel
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -298,7 +302,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -312,7 +315,7 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Channel", pipeline_response)
+ deserialized = self._deserialize("Channel", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -410,7 +413,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventgrid.models.Channel
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -445,7 +448,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -459,21 +461,17 @@ def create_or_update(
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("Channel", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Channel", pipeline_response)
+ deserialized = self._deserialize("Channel", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self, resource_group_name: str, partner_namespace_name: str, channel_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -485,7 +483,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -496,10 +494,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -507,6 +505,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -514,8 +516,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -545,7 +551,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
partner_namespace_name=partner_namespace_name,
channel_name=channel_name,
@@ -555,6 +561,7 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -577,7 +584,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-
return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore
@overload
- def update( # pylint: disable=inconsistent-return-statements
+ def update(
self,
resource_group_name: str,
partner_namespace_name: str,
@@ -609,7 +616,7 @@ def update( # pylint: disable=inconsistent-return-statements
"""
@overload
- def update( # pylint: disable=inconsistent-return-statements
+ def update(
self,
resource_group_name: str,
partner_namespace_name: str,
@@ -668,7 +675,7 @@ def update( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -703,7 +710,6 @@ def update( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -760,7 +766,7 @@ def list_by_partner_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ChannelsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -781,7 +787,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -797,7 +802,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -845,7 +849,7 @@ def get_full_url(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -868,7 +872,6 @@ def get_full_url(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -882,7 +885,7 @@ def get_full_url(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response)
+ deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_client_groups_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_client_groups_operations.py
index feb47b262b39..3f627902a5cb 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_client_groups_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_client_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.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +16,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +31,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +49,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -81,7 +85,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -120,7 +124,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -162,7 +166,7 @@ def build_list_by_namespace_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -231,7 +235,7 @@ def get(
:rtype: ~azure.mgmt.eventgrid.models.ClientGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -254,7 +258,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -269,7 +272,7 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ClientGroup", pipeline_response)
+ deserialized = self._deserialize("ClientGroup", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -283,8 +286,8 @@ def _create_or_update_initial(
client_group_name: str,
client_group_info: Union[_models.ClientGroup, IO[bytes]],
**kwargs: Any
- ) -> _models.ClientGroup:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -297,7 +300,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.ClientGroup] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -319,10 +322,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -330,15 +333,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ 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 = self._deserialize("ClientGroup", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("ClientGroup", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -461,10 +464,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("ClientGroup", pipeline_response)
+ deserialized = self._deserialize("ClientGroup", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -488,10 +492,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self, resource_group_name: str, namespace_name: str, client_group_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -503,7 +507,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -514,10 +518,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -525,6 +529,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -533,8 +541,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -564,7 +576,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
namespace_name=namespace_name,
client_group_name=client_group_name,
@@ -574,6 +586,7 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -637,7 +650,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClientGroupsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -658,7 +671,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -674,7 +686,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_clients_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_clients_operations.py
index 2f4d382c6d68..56a14f0f59b8 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_clients_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_clients_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,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +16,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +31,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +49,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -81,7 +85,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -120,7 +124,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -162,7 +166,7 @@ def build_list_by_namespace_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -229,7 +233,7 @@ def get(self, resource_group_name: str, namespace_name: str, client_name: str, *
:rtype: ~azure.mgmt.eventgrid.models.Client
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -252,7 +256,6 @@ def get(self, resource_group_name: str, namespace_name: str, client_name: str, *
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -267,7 +270,7 @@ def get(self, resource_group_name: str, namespace_name: str, client_name: str, *
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Client", pipeline_response)
+ deserialized = self._deserialize("Client", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -281,8 +284,8 @@ def _create_or_update_initial(
client_name: str,
client_info: Union[_models.Client, IO[bytes]],
**kwargs: Any
- ) -> _models.Client:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -295,7 +298,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Client] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -317,10 +320,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -328,15 +331,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ 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 = self._deserialize("Client", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Client", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -455,10 +458,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Client", pipeline_response)
+ deserialized = self._deserialize("Client", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -482,10 +486,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self, resource_group_name: str, namespace_name: str, client_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -497,7 +501,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -508,10 +512,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -519,6 +523,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -527,8 +535,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -558,7 +570,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
namespace_name=namespace_name,
client_name=client_name,
@@ -568,6 +580,7 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -631,7 +644,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClientsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -652,7 +665,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -668,7 +680,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_event_subscriptions_operations.py
index 47f7488c6800..82ba944f68f1 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_event_subscriptions_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_event_subscriptions_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +50,7 @@ def build_get_delivery_attributes_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -77,7 +82,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -109,7 +114,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -143,7 +148,7 @@ def build_delete_request(
) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
# Construct URL
_url = kwargs.pop(
"template_url",
@@ -170,7 +175,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -205,7 +210,7 @@ def build_get_full_url_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -243,7 +248,7 @@ def build_list_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -310,7 +315,7 @@ def get_delivery_attributes(
:rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -333,7 +338,6 @@ def get_delivery_attributes(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -347,7 +351,7 @@ def get_delivery_attributes(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response)
+ deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -373,7 +377,7 @@ def get(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscription
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -396,7 +400,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -410,7 +413,7 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -424,8 +427,8 @@ def _create_or_update_initial(
event_subscription_name: str,
event_subscription_info: Union[_models.EventSubscription, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -438,7 +441,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -460,10 +463,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -471,14 +474,14 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("EventSubscription", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -609,10 +612,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -634,10 +638,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self, resource_group_name: str, domain_name: str, event_subscription_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -649,7 +653,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -660,10 +664,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -671,6 +675,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -678,8 +686,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -709,7 +721,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
domain_name=domain_name,
event_subscription_name=event_subscription_name,
@@ -719,6 +731,7 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -747,8 +760,8 @@ def _update_initial(
event_subscription_name: str,
event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -761,7 +774,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -783,10 +796,10 @@ def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -794,10 +807,14 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -922,10 +939,11 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -966,7 +984,7 @@ def get_full_url(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -989,7 +1007,6 @@ def get_full_url(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1003,7 +1020,7 @@ def get_full_url(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response)
+ deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1050,7 +1067,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1071,7 +1088,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1087,7 +1103,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topic_event_subscriptions_operations.py
index 44138e6e7b74..45f70e36c8a7 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topic_event_subscriptions_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topic_event_subscriptions_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +55,7 @@ def build_get_delivery_attributes_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -88,7 +93,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -126,7 +131,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -166,7 +171,7 @@ def build_delete_request(
) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
# Construct URL
_url = kwargs.pop(
"template_url",
@@ -199,7 +204,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -240,7 +245,7 @@ def build_get_full_url_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -280,7 +285,7 @@ def build_list_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -350,7 +355,7 @@ def get_delivery_attributes(
:rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -374,7 +379,6 @@ def get_delivery_attributes(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -388,7 +392,7 @@ def get_delivery_attributes(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response)
+ deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -416,7 +420,7 @@ def get(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscription
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -440,7 +444,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -454,7 +457,7 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -469,8 +472,8 @@ def _create_or_update_initial(
event_subscription_name: str,
event_subscription_info: Union[_models.EventSubscription, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -483,7 +486,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -506,10 +509,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -517,14 +520,14 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("EventSubscription", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -665,10 +668,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -690,10 +694,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self, resource_group_name: str, domain_name: str, topic_name: str, event_subscription_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -705,7 +709,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -717,10 +721,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -728,6 +732,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -735,8 +743,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -768,7 +780,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
domain_name=domain_name,
topic_name=topic_name,
@@ -779,6 +791,7 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -808,8 +821,8 @@ def _update_initial(
event_subscription_name: str,
event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -822,7 +835,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -845,10 +858,10 @@ def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -856,10 +869,14 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -994,10 +1011,11 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -1040,7 +1058,7 @@ def get_full_url(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1064,7 +1082,6 @@ def get_full_url(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1078,7 +1095,7 @@ def get_full_url(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response)
+ deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1128,7 +1145,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1150,7 +1167,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1166,7 +1182,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topics_operations.py
index 7afe831b44cf..ac0294d33991 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topics_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domain_topics_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,7 +5,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast
+import sys
+from typing import Any, Callable, Dict, Iterable, Iterator, Optional, TypeVar, Union, cast
import urllib.parse
from azure.core.exceptions import (
@@ -15,13 +15,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -29,8 +30,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -44,7 +48,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -76,7 +80,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -107,7 +111,7 @@ def build_delete_request(
) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
# Construct URL
_url = kwargs.pop(
"template_url",
@@ -140,7 +144,7 @@ def build_list_by_domain_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -207,7 +211,7 @@ def get(
:rtype: ~azure.mgmt.eventgrid.models.DomainTopic
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -230,7 +234,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -244,7 +247,7 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DomainTopic", pipeline_response)
+ deserialized = self._deserialize("DomainTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -253,8 +256,8 @@ def get(
def _create_or_update_initial(
self, resource_group_name: str, domain_name: str, domain_topic_name: str, **kwargs: Any
- ) -> _models.DomainTopic:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -266,7 +269,7 @@ def _create_or_update_initial(
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[_models.DomainTopic] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_create_or_update_request(
resource_group_name=resource_group_name,
@@ -277,10 +280,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -288,10 +291,14 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DomainTopic", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -337,10 +344,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("DomainTopic", pipeline_response)
+ deserialized = self._deserialize("DomainTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -362,10 +370,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self, resource_group_name: str, domain_name: str, domain_topic_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -377,7 +385,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -388,10 +396,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -399,6 +407,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -406,8 +418,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -437,7 +453,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
domain_name=domain_name,
domain_topic_name=domain_topic_name,
@@ -447,6 +463,7 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -508,7 +525,7 @@ def list_by_domain(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DomainTopicsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -529,7 +546,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -545,7 +561,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domains_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domains_operations.py
index 5d0a201f64ce..2d5055322f3e 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domains_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_domains_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -43,7 +48,7 @@ def build_get_request(resource_group_name: str, domain_name: str, subscription_i
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -74,7 +79,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -107,7 +112,7 @@ def build_delete_request(
) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
# Construct URL
_url = kwargs.pop(
"template_url",
@@ -133,7 +138,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -167,7 +172,7 @@ def build_list_by_subscription_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -202,7 +207,7 @@ def build_list_by_resource_group_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -236,7 +241,7 @@ def build_list_shared_access_keys_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -267,7 +272,7 @@ def build_regenerate_key_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -329,7 +334,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod
:rtype: ~azure.mgmt.eventgrid.models.Domain
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -351,7 +356,6 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -365,7 +369,7 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Domain", pipeline_response)
+ deserialized = self._deserialize("Domain", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -374,8 +378,8 @@ def get(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> _mod
def _create_or_update_initial(
self, resource_group_name: str, domain_name: str, domain_info: Union[_models.Domain, IO[bytes]], **kwargs: Any
- ) -> _models.Domain:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -388,7 +392,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Domain] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -409,10 +413,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -420,10 +424,14 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Domain", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -528,10 +536,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Domain", pipeline_response)
+ deserialized = self._deserialize("Domain", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -553,10 +562,8 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, domain_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ def _delete_initial(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -568,7 +575,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -578,10 +585,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -589,6 +596,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -596,8 +607,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(self, resource_group_name: str, domain_name: str, **kwargs: Any) -> LROPoller[None]:
@@ -623,7 +638,7 @@ def begin_delete(self, resource_group_name: str, domain_name: str, **kwargs: Any
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
domain_name=domain_name,
api_version=api_version,
@@ -632,6 +647,7 @@ def begin_delete(self, resource_group_name: str, domain_name: str, **kwargs: Any
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -659,8 +675,8 @@ def _update_initial(
domain_name: str,
domain_update_parameters: Union[_models.DomainUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.Domain]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -673,7 +689,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.Domain]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -694,10 +710,10 @@ def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -705,12 +721,14 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 201:
- deserialized = self._deserialize("Domain", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -821,10 +839,11 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Domain", pipeline_response)
+ deserialized = self._deserialize("Domain", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -876,7 +895,7 @@ def list_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DomainsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -895,7 +914,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -911,7 +929,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -973,7 +990,7 @@ def list_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DomainsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -993,7 +1010,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1009,7 +1025,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1055,7 +1070,7 @@ def list_shared_access_keys(
:rtype: ~azure.mgmt.eventgrid.models.DomainSharedAccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1077,7 +1092,6 @@ def list_shared_access_keys(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1091,7 +1105,7 @@ def list_shared_access_keys(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DomainSharedAccessKeys", pipeline_response)
+ deserialized = self._deserialize("DomainSharedAccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1181,7 +1195,7 @@ def regenerate_key(
:rtype: ~azure.mgmt.eventgrid.models.DomainSharedAccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1215,7 +1229,6 @@ def regenerate_key(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1229,7 +1242,7 @@ def regenerate_key(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DomainSharedAccessKeys", pipeline_response)
+ deserialized = self._deserialize("DomainSharedAccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_subscriptions_operations.py
index 70e20774cafa..fb3acd5eb51a 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_subscriptions_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_event_subscriptions_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -43,7 +48,7 @@ def build_get_delivery_attributes_request(scope: str, event_subscription_name: s
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,7 +76,7 @@ def build_get_request(scope: str, event_subscription_name: str, **kwargs: Any) -
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -98,7 +103,7 @@ def build_create_or_update_request(scope: str, event_subscription_name: str, **k
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -127,7 +132,7 @@ def build_create_or_update_request(scope: str, event_subscription_name: str, **k
def build_delete_request(scope: str, event_subscription_name: str, **kwargs: Any) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
# Construct URL
_url = kwargs.pop(
"template_url", "/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}"
@@ -149,7 +154,7 @@ def build_update_request(scope: str, event_subscription_name: str, **kwargs: Any
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -179,7 +184,7 @@ def build_get_full_url_request(scope: str, event_subscription_name: str, **kwarg
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -208,7 +213,7 @@ def build_list_global_by_subscription_request( # pylint: disable=name-too-long
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -245,7 +250,7 @@ def build_list_global_by_subscription_for_topic_type_request( # pylint: disable
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -284,7 +289,7 @@ def build_list_global_by_resource_group_request( # pylint: disable=name-too-lon
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -324,7 +329,7 @@ def build_list_global_by_resource_group_for_topic_type_request( # pylint: disab
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -359,7 +364,7 @@ def build_list_regional_by_subscription_request( # pylint: disable=name-too-lon
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -399,7 +404,7 @@ def build_list_regional_by_resource_group_request( # pylint: disable=name-too-l
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -440,7 +445,7 @@ def build_list_regional_by_subscription_for_topic_type_request( # pylint: disab
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -482,7 +487,7 @@ def build_list_regional_by_resource_group_for_topic_type_request( # pylint: dis
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -526,7 +531,7 @@ def build_list_by_resource_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -570,7 +575,7 @@ def build_list_by_domain_topic_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -623,6 +628,7 @@ def __init__(self, *args, **kwargs):
def get_delivery_attributes(
self, scope: str, event_subscription_name: str, **kwargs: Any
) -> _models.DeliveryAttributeListResult:
+ # pylint: disable=line-too-long
"""Get delivery attributes for an event subscription.
Get all delivery attributes for an event subscription.
@@ -642,7 +648,7 @@ def get_delivery_attributes(
:rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -663,7 +669,6 @@ def get_delivery_attributes(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -677,7 +682,7 @@ def get_delivery_attributes(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response)
+ deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -686,6 +691,7 @@ def get_delivery_attributes(
@distributed_trace
def get(self, scope: str, event_subscription_name: str, **kwargs: Any) -> _models.EventSubscription:
+ # pylint: disable=line-too-long
"""Get an event subscription.
Get properties of an event subscription.
@@ -705,7 +711,7 @@ def get(self, scope: str, event_subscription_name: str, **kwargs: Any) -> _model
:rtype: ~azure.mgmt.eventgrid.models.EventSubscription
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -726,7 +732,6 @@ def get(self, scope: str, event_subscription_name: str, **kwargs: Any) -> _model
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -740,7 +745,7 @@ def get(self, scope: str, event_subscription_name: str, **kwargs: Any) -> _model
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -753,8 +758,8 @@ def _create_or_update_initial(
event_subscription_name: str,
event_subscription_info: Union[_models.EventSubscription, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -767,7 +772,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -787,10 +792,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -798,10 +803,14 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -818,6 +827,7 @@ def begin_create_or_update(
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.EventSubscription]:
+ # pylint: disable=line-too-long
"""Create or update an event subscription.
Asynchronously creates a new event subscription or updates an existing event subscription based
@@ -859,6 +869,7 @@ def begin_create_or_update(
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.EventSubscription]:
+ # pylint: disable=line-too-long
"""Create or update an event subscription.
Asynchronously creates a new event subscription or updates an existing event subscription based
@@ -898,6 +909,7 @@ def begin_create_or_update(
event_subscription_info: Union[_models.EventSubscription, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.EventSubscription]:
+ # pylint: disable=line-too-long
"""Create or update an event subscription.
Asynchronously creates a new event subscription or updates an existing event subscription based
@@ -946,10 +958,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -971,10 +984,8 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
- self, scope: str, event_subscription_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ def _delete_initial(self, scope: str, event_subscription_name: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -986,7 +997,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
scope=scope,
@@ -995,10 +1006,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -1006,6 +1017,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -1013,11 +1028,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(self, scope: str, event_subscription_name: str, **kwargs: Any) -> LROPoller[None]:
+ # pylint: disable=line-too-long
"""Delete an event subscription.
Delete an existing event subscription.
@@ -1046,7 +1066,7 @@ def begin_delete(self, scope: str, event_subscription_name: str, **kwargs: Any)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
scope=scope,
event_subscription_name=event_subscription_name,
api_version=api_version,
@@ -1055,6 +1075,7 @@ def begin_delete(self, scope: str, event_subscription_name: str, **kwargs: Any)
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -1082,8 +1103,8 @@ def _update_initial(
event_subscription_name: str,
event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1096,7 +1117,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -1116,10 +1137,10 @@ def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -1127,10 +1148,14 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1147,6 +1172,7 @@ def begin_update(
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.EventSubscription]:
+ # pylint: disable=line-too-long
"""Update an event subscription.
Asynchronously updates an existing event subscription.
@@ -1184,6 +1210,7 @@ def begin_update(
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.EventSubscription]:
+ # pylint: disable=line-too-long
"""Update an event subscription.
Asynchronously updates an existing event subscription.
@@ -1218,6 +1245,7 @@ def begin_update(
event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[_models.EventSubscription]:
+ # pylint: disable=line-too-long
"""Update an event subscription.
Asynchronously updates an existing event subscription.
@@ -1263,10 +1291,11 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -1290,6 +1319,7 @@ def get_long_running_output(pipeline_response):
@distributed_trace
def get_full_url(self, scope: str, event_subscription_name: str, **kwargs: Any) -> _models.EventSubscriptionFullUrl:
+ # pylint: disable=line-too-long
"""Get full URL of an event subscription.
Get the full endpoint URL for an event subscription.
@@ -1309,7 +1339,7 @@ def get_full_url(self, scope: str, event_subscription_name: str, **kwargs: Any)
:rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1330,7 +1360,6 @@ def get_full_url(self, scope: str, event_subscription_name: str, **kwargs: Any)
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1344,7 +1373,7 @@ def get_full_url(self, scope: str, event_subscription_name: str, **kwargs: Any)
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response)
+ deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1381,7 +1410,7 @@ def list_global_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1400,7 +1429,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1416,7 +1444,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1477,7 +1504,7 @@ def list_global_by_subscription_for_topic_type( # pylint: disable=name-too-long
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1497,7 +1524,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1513,7 +1539,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1575,7 +1600,7 @@ def list_global_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1595,7 +1620,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1611,7 +1635,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1680,7 +1703,7 @@ def list_global_by_resource_group_for_topic_type( # pylint: disable=name-too-lo
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1701,7 +1724,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1717,7 +1739,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1778,7 +1799,7 @@ def list_regional_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1798,7 +1819,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1814,7 +1834,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1884,7 +1903,7 @@ def list_regional_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1905,7 +1924,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1921,7 +1939,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1990,7 +2007,7 @@ def list_regional_by_subscription_for_topic_type( # pylint: disable=name-too-lo
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2011,7 +2028,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -2027,7 +2043,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -2101,7 +2116,7 @@ def list_regional_by_resource_group_for_topic_type( # pylint: disable=name-too-
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2123,7 +2138,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -2139,7 +2153,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -2214,7 +2227,7 @@ def list_by_resource(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2237,7 +2250,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -2253,7 +2265,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -2325,7 +2336,7 @@ def list_by_domain_topic(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2347,7 +2358,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -2363,7 +2373,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py
index c08a4a864614..5fd0563243fa 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_extension_topics_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import (
@@ -17,16 +17,18 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -38,7 +40,7 @@ def build_get_request(scope: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -79,6 +81,7 @@ def __init__(self, *args, **kwargs):
@distributed_trace
def get(self, scope: str, **kwargs: Any) -> _models.ExtensionTopic:
+ # pylint: disable=line-too-long
"""Get properties of an extension topic.
Get the properties of an extension topic.
@@ -94,7 +97,7 @@ def get(self, scope: str, **kwargs: Any) -> _models.ExtensionTopic:
:rtype: ~azure.mgmt.eventgrid.models.ExtensionTopic
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -114,7 +117,6 @@ def get(self, scope: str, **kwargs: Any) -> _models.ExtensionTopic:
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -128,7 +130,7 @@ def get(self, scope: str, **kwargs: Any) -> _models.ExtensionTopic:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("ExtensionTopic", pipeline_response)
+ deserialized = self._deserialize("ExtensionTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespace_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespace_topic_event_subscriptions_operations.py
index db4c277db6f0..7aa5a06a4478 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespace_topic_event_subscriptions_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespace_topic_event_subscriptions_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +55,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -99,7 +104,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -151,7 +156,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -200,7 +205,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -254,7 +259,7 @@ def build_list_by_namespace_topic_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -299,7 +304,7 @@ def build_get_delivery_attributes_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -348,7 +353,7 @@ def build_get_full_url_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -431,7 +436,7 @@ def get(
:rtype: ~azure.mgmt.eventgrid.models.Subscription
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -455,7 +460,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -470,7 +474,7 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Subscription", pipeline_response)
+ deserialized = self._deserialize("Subscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -485,8 +489,8 @@ def _create_or_update_initial(
event_subscription_name: str,
event_subscription_info: Union[_models.Subscription, IO[bytes]],
**kwargs: Any
- ) -> _models.Subscription:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -499,7 +503,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Subscription] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -522,10 +526,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -533,15 +537,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ 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 = self._deserialize("Subscription", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Subscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -685,10 +689,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Subscription", pipeline_response)
+ deserialized = self._deserialize("Subscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -712,15 +717,15 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
namespace_name: str,
topic_name: str,
event_subscription_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -732,7 +737,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -744,10 +749,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -755,6 +760,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -763,8 +772,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -801,7 +814,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
namespace_name=namespace_name,
topic_name=topic_name,
@@ -812,6 +825,7 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -843,8 +857,8 @@ def _update_initial(
event_subscription_name: str,
event_subscription_update_parameters: Union[_models.SubscriptionUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.Subscription:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -857,7 +871,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Subscription] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -880,10 +894,10 @@ def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -891,18 +905,19 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("Subscription", pipeline_response)
-
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
- deserialized = self._deserialize("Subscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1037,10 +1052,11 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Subscription", pipeline_response)
+ deserialized = self._deserialize("Subscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -1107,7 +1123,7 @@ def list_by_namespace_topic(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.SubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1129,7 +1145,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1145,7 +1160,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1201,7 +1215,7 @@ def get_delivery_attributes(
:rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1225,7 +1239,6 @@ def get_delivery_attributes(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1240,7 +1253,7 @@ def get_delivery_attributes(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response)
+ deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1273,7 +1286,7 @@ def get_full_url(
:rtype: ~azure.mgmt.eventgrid.models.SubscriptionFullUrl
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1297,7 +1310,6 @@ def get_full_url(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1312,7 +1324,7 @@ def get_full_url(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SubscriptionFullUrl", pipeline_response)
+ deserialized = self._deserialize("SubscriptionFullUrl", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespace_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespace_topics_operations.py
index 40ae9610eda2..d525cebfd177 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespace_topics_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespace_topics_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +50,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -81,7 +86,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -120,7 +125,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -156,7 +161,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -201,7 +206,7 @@ def build_list_by_namespace_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -238,7 +243,7 @@ def build_list_shared_access_keys_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -274,7 +279,7 @@ def build_regenerate_key_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -345,7 +350,7 @@ def get(
:rtype: ~azure.mgmt.eventgrid.models.NamespaceTopic
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -368,7 +373,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -383,7 +387,7 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NamespaceTopic", pipeline_response)
+ deserialized = self._deserialize("NamespaceTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -397,8 +401,8 @@ def _create_or_update_initial(
topic_name: str,
namespace_topic_info: Union[_models.NamespaceTopic, IO[bytes]],
**kwargs: Any
- ) -> _models.NamespaceTopic:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -411,7 +415,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.NamespaceTopic] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -433,10 +437,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -444,15 +448,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ 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 = self._deserialize("NamespaceTopic", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("NamespaceTopic", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -575,10 +579,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("NamespaceTopic", pipeline_response)
+ deserialized = self._deserialize("NamespaceTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -602,10 +607,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self, resource_group_name: str, namespace_name: str, topic_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -617,7 +622,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -628,10 +633,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -639,6 +644,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -647,8 +656,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -678,7 +691,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
namespace_name=namespace_name,
topic_name=topic_name,
@@ -688,6 +701,7 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -718,8 +732,8 @@ def _update_initial(
topic_name: str,
namespace_topic_update_parameters: Union[_models.NamespaceTopicUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.NamespaceTopic:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -732,7 +746,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.NamespaceTopic] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -754,10 +768,10 @@ def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -765,18 +779,19 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("NamespaceTopic", pipeline_response)
-
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
- deserialized = self._deserialize("NamespaceTopic", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -901,10 +916,11 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("NamespaceTopic", pipeline_response)
+ deserialized = self._deserialize("NamespaceTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -968,7 +984,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.NamespaceTopicsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -989,7 +1005,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1005,7 +1020,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1054,7 +1068,7 @@ def list_shared_access_keys(
:rtype: ~azure.mgmt.eventgrid.models.TopicSharedAccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1077,7 +1091,6 @@ def list_shared_access_keys(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1092,7 +1105,7 @@ def list_shared_access_keys(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response)
+ deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1106,8 +1119,8 @@ def _regenerate_key_initial(
topic_name: str,
regenerate_key_request: Union[_models.TopicRegenerateKeyRequest, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.TopicSharedAccessKeys]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1120,7 +1133,7 @@ def _regenerate_key_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.TopicSharedAccessKeys]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -1142,10 +1155,10 @@ def _regenerate_key_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -1153,18 +1166,20 @@ def _regenerate_key_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response)
-
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1287,10 +1302,11 @@ def begin_regenerate_key(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response)
+ deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespaces_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespaces_operations.py
index b9b766db6ac5..c09570a76335 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_namespaces_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +50,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -78,7 +83,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -114,7 +119,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -147,7 +152,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -183,7 +188,7 @@ def build_list_by_subscription_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -218,7 +223,7 @@ def build_list_by_resource_group_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -252,7 +257,7 @@ def build_list_shared_access_keys_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -285,7 +290,7 @@ def build_regenerate_key_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -321,7 +326,7 @@ def build_validate_custom_domain_ownership_request( # pylint: disable=name-too-
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -382,7 +387,7 @@ def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _
:rtype: ~azure.mgmt.eventgrid.models.Namespace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -404,7 +409,6 @@ def get(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> _
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -419,7 +423,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)
- deserialized = self._deserialize("Namespace", pipeline_response)
+ deserialized = self._deserialize("Namespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -432,8 +436,8 @@ def _create_or_update_initial(
namespace_name: str,
namespace_info: Union[_models.Namespace, IO[bytes]],
**kwargs: Any
- ) -> _models.Namespace:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -446,7 +450,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Namespace] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -467,10 +471,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -478,15 +482,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ 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 = self._deserialize("Namespace", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("Namespace", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -596,10 +600,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Namespace", pipeline_response)
+ deserialized = self._deserialize("Namespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -623,10 +628,8 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, namespace_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ def _delete_initial(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -638,7 +641,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -648,10 +651,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -659,6 +662,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -667,8 +674,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs: Any) -> LROPoller[None]:
@@ -694,7 +705,7 @@ def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs:
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
namespace_name=namespace_name,
api_version=api_version,
@@ -703,6 +714,7 @@ def begin_delete(self, resource_group_name: str, namespace_name: str, **kwargs:
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -732,8 +744,8 @@ def _update_initial(
namespace_name: str,
namespace_update_parameters: Union[_models.NamespaceUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.Namespace:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -746,7 +758,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Namespace] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -767,10 +779,10 @@ def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -778,18 +790,19 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("Namespace", pipeline_response)
-
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
- deserialized = self._deserialize("Namespace", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -900,10 +913,11 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Namespace", pipeline_response)
+ deserialized = self._deserialize("Namespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -957,7 +971,7 @@ def list_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.NamespacesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -976,7 +990,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -992,7 +1005,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1055,7 +1067,7 @@ def list_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.NamespacesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1075,7 +1087,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1091,7 +1102,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1138,7 +1148,7 @@ def list_shared_access_keys(
:rtype: ~azure.mgmt.eventgrid.models.NamespaceSharedAccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1160,7 +1170,6 @@ def list_shared_access_keys(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1175,7 +1184,7 @@ def list_shared_access_keys(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NamespaceSharedAccessKeys", pipeline_response)
+ deserialized = self._deserialize("NamespaceSharedAccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1188,8 +1197,8 @@ def _regenerate_key_initial(
namespace_name: str,
regenerate_key_request: Union[_models.NamespaceRegenerateKeyRequest, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.NamespaceSharedAccessKeys]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1202,7 +1211,7 @@ def _regenerate_key_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.NamespaceSharedAccessKeys]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -1223,10 +1232,10 @@ def _regenerate_key_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -1234,18 +1243,20 @@ def _regenerate_key_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("NamespaceSharedAccessKeys", pipeline_response)
-
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1358,10 +1369,11 @@ def begin_regenerate_key(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("NamespaceSharedAccessKeys", pipeline_response)
+ deserialized = self._deserialize("NamespaceSharedAccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -1387,8 +1399,8 @@ def get_long_running_output(pipeline_response):
def _validate_custom_domain_ownership_initial( # pylint: disable=name-too-long
self, resource_group_name: str, namespace_name: str, **kwargs: Any
- ) -> Optional[_models.CustomDomainOwnershipValidationResult]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1400,7 +1412,7 @@ def _validate_custom_domain_ownership_initial( # pylint: disable=name-too-long
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[Optional[_models.CustomDomainOwnershipValidationResult]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_validate_custom_domain_ownership_request(
resource_group_name=resource_group_name,
@@ -1410,10 +1422,10 @@ def _validate_custom_domain_ownership_initial( # pylint: disable=name-too-long
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -1421,18 +1433,20 @@ def _validate_custom_domain_ownership_initial( # pylint: disable=name-too-long
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("CustomDomainOwnershipValidationResult", pipeline_response)
-
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1475,10 +1489,11 @@ def begin_validate_custom_domain_ownership(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("CustomDomainOwnershipValidationResult", pipeline_response)
+ deserialized = self._deserialize("CustomDomainOwnershipValidationResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_network_security_perimeter_configurations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_network_security_perimeter_configurations_operations.py
index 7d6ac4058e07..581a90c2127f 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_network_security_perimeter_configurations_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/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.
@@ -6,7 +5,8 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast
+import sys
+from typing import Any, Callable, Dict, Iterable, Iterator, Optional, TypeVar, Union, cast
import urllib.parse
from azure.core.exceptions import (
@@ -15,13 +15,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -29,8 +30,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +54,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -92,7 +96,7 @@ def build_reconcile_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -132,7 +136,7 @@ def build_list_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -196,8 +200,8 @@ def get(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param resource_type: The type of the resource. This can be either \'topics\', or \'domains\'.
- Known values are: "topics" and "domains". Required.
+ :param resource_type: The type of the resource. This can be either \\'topics\\', or
+ \\'domains\\'. Known values are: "topics" and "domains". Required.
:type resource_type: str or ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterResourceType
:param resource_name: The name of the resource (namely, either, the topic name or domain name).
Required.
@@ -211,7 +215,7 @@ def get(
:rtype: ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -236,7 +240,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -251,7 +254,7 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response)
+ deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -266,8 +269,8 @@ def _reconcile_initial(
perimeter_guid: str,
association_name: str,
**kwargs: Any
- ) -> Optional[_models.NetworkSecurityPerimeterConfiguration]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -279,7 +282,7 @@ def _reconcile_initial(
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[Optional[_models.NetworkSecurityPerimeterConfiguration]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_reconcile_request(
resource_group_name=resource_group_name,
@@ -292,10 +295,10 @@ def _reconcile_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -303,18 +306,20 @@ def _reconcile_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response)
-
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -339,8 +344,8 @@ def begin_reconcile(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param resource_type: The type of the resource. This can be either \'topics\' or \'domains\'.
- Known values are: "topics" and "domains". Required.
+ :param resource_type: The type of the resource. This can be either \\'topics\\' or
+ \\'domains\\'. Known values are: "topics" and "domains". Required.
:type resource_type: str or ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterResourceType
:param resource_name: The name of the resource (namely, either, the topic name or domain name).
Required.
@@ -377,10 +382,11 @@ def begin_reconcile(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response)
+ deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -419,8 +425,8 @@ def list(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param resource_type: The type of the resource. This can be either \'topics\' or \'domains\'.
- Known values are: "topics" and "domains". Required.
+ :param resource_type: The type of the resource. This can be either \\'topics\\' or
+ \\'domains\\'. Known values are: "topics" and "domains". Required.
:type resource_type: str or ~azure.mgmt.eventgrid.models.NetworkSecurityPerimeterResourceType
:param resource_name: The name of the resource (namely, either, the topic name or domain name).
Required.
@@ -437,7 +443,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.NetworkSecurityPerimeterConfigurationList] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -457,7 +463,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -473,7 +478,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_operations.py
index 87d02f3558e0..d625ef5b4b0e 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/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.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -40,7 +42,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -90,7 +92,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -106,7 +108,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -122,7 +123,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_configurations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_configurations_operations.py
index c0c150ae67a8..4d3451c64cec 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_configurations_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_configurations_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -43,7 +48,7 @@ def build_get_request(resource_group_name: str, subscription_id: str, **kwargs:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -71,7 +76,7 @@ def build_create_or_update_request(resource_group_name: str, subscription_id: st
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -101,7 +106,7 @@ def build_create_or_update_request(resource_group_name: str, subscription_id: st
def build_delete_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
# Construct URL
_url = kwargs.pop(
"template_url",
@@ -124,7 +129,7 @@ def build_update_request(resource_group_name: str, subscription_id: str, **kwarg
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -155,7 +160,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -185,7 +190,7 @@ def build_list_by_subscription_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -215,7 +220,7 @@ def build_authorize_partner_request(resource_group_name: str, subscription_id: s
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -246,7 +251,7 @@ def build_unauthorize_partner_request(resource_group_name: str, subscription_id:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -305,7 +310,7 @@ def get(self, resource_group_name: str, **kwargs: Any) -> _models.PartnerConfigu
:rtype: ~azure.mgmt.eventgrid.models.PartnerConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -326,7 +331,6 @@ def get(self, resource_group_name: str, **kwargs: Any) -> _models.PartnerConfigu
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -340,7 +344,7 @@ def get(self, resource_group_name: str, **kwargs: Any) -> _models.PartnerConfigu
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerConfiguration", pipeline_response)
+ deserialized = self._deserialize("PartnerConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -352,8 +356,8 @@ def _create_or_update_initial(
resource_group_name: str,
partner_configuration_info: Union[_models.PartnerConfiguration, IO[bytes]],
**kwargs: Any
- ) -> _models.PartnerConfiguration:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -366,7 +370,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PartnerConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -386,10 +390,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -397,14 +401,14 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("PartnerConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PartnerConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -508,10 +512,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PartnerConfiguration", pipeline_response)
+ deserialized = self._deserialize("PartnerConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -533,10 +538,8 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ def _delete_initial(self, resource_group_name: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -548,7 +551,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -557,10 +560,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -568,6 +571,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -575,8 +582,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(self, resource_group_name: str, **kwargs: Any) -> LROPoller[None]:
@@ -600,7 +611,7 @@ def begin_delete(self, resource_group_name: str, **kwargs: Any) -> LROPoller[Non
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
api_version=api_version,
cls=lambda x, y, z: x,
@@ -608,6 +619,7 @@ def begin_delete(self, resource_group_name: str, **kwargs: Any) -> LROPoller[Non
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -634,8 +646,8 @@ def _update_initial(
resource_group_name: str,
partner_configuration_update_parameters: Union[_models.PartnerConfigurationUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.PartnerConfiguration:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -648,7 +660,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PartnerConfiguration] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -670,10 +682,10 @@ def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -681,14 +693,14 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("PartnerConfiguration", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PartnerConfiguration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -795,10 +807,11 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PartnerConfiguration", pipeline_response)
+ deserialized = self._deserialize("PartnerConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -842,7 +855,7 @@ def list_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartnerConfigurationsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -860,7 +873,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -876,7 +888,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -936,7 +947,7 @@ def list_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartnerConfigurationsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -955,7 +966,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -971,7 +981,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1070,7 +1079,7 @@ def authorize_partner(
:rtype: ~azure.mgmt.eventgrid.models.PartnerConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1103,7 +1112,6 @@ def authorize_partner(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1117,7 +1125,7 @@ def authorize_partner(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerConfiguration", pipeline_response)
+ deserialized = self._deserialize("PartnerConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1194,7 +1202,7 @@ def unauthorize_partner(
:rtype: ~azure.mgmt.eventgrid.models.PartnerConfiguration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1227,7 +1235,6 @@ def unauthorize_partner(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1241,7 +1248,7 @@ def unauthorize_partner(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerConfiguration", pipeline_response)
+ deserialized = self._deserialize("PartnerConfiguration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_destinations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_destinations_operations.py
index 7234261bc60e..53801a3f1961 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_destinations_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_destinations_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +50,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -83,7 +88,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -124,7 +129,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -162,7 +167,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -203,7 +208,7 @@ def build_list_by_subscription_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -240,7 +245,7 @@ def build_list_by_resource_group_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -274,7 +279,7 @@ def build_activate_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -340,7 +345,7 @@ def get(self, resource_group_name: str, partner_destination_name: str, **kwargs:
:rtype: ~azure.mgmt.eventgrid.models.PartnerDestination
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -362,7 +367,6 @@ def get(self, resource_group_name: str, partner_destination_name: str, **kwargs:
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -377,7 +381,7 @@ def get(self, resource_group_name: str, partner_destination_name: str, **kwargs:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerDestination", pipeline_response)
+ deserialized = self._deserialize("PartnerDestination", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -390,8 +394,8 @@ def _create_or_update_initial(
partner_destination_name: str,
partner_destination: Union[_models.PartnerDestination, IO[bytes]],
**kwargs: Any
- ) -> _models.PartnerDestination:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -404,7 +408,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PartnerDestination] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -425,10 +429,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -436,15 +440,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ 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 = self._deserialize("PartnerDestination", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PartnerDestination", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -557,10 +561,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PartnerDestination", pipeline_response)
+ deserialized = self._deserialize("PartnerDestination", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -584,10 +589,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self, resource_group_name: str, partner_destination_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -599,7 +604,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -609,10 +614,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -620,6 +625,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -628,8 +637,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(self, resource_group_name: str, partner_destination_name: str, **kwargs: Any) -> LROPoller[None]:
@@ -655,7 +668,7 @@ def begin_delete(self, resource_group_name: str, partner_destination_name: str,
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
partner_destination_name=partner_destination_name,
api_version=api_version,
@@ -664,6 +677,7 @@ def begin_delete(self, resource_group_name: str, partner_destination_name: str,
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -693,8 +707,8 @@ def _update_initial(
partner_destination_name: str,
partner_destination_update_parameters: Union[_models.PartnerDestinationUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.PartnerDestination:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -707,7 +721,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PartnerDestination] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -728,10 +742,10 @@ def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -739,21 +753,19 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("PartnerDestination", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PartnerDestination", pipeline_response)
-
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
- deserialized = self._deserialize("PartnerDestination", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -868,10 +880,11 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PartnerDestination", pipeline_response)
+ deserialized = self._deserialize("PartnerDestination", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -925,7 +938,7 @@ def list_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartnerDestinationsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -944,7 +957,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -960,7 +972,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1023,7 +1034,7 @@ def list_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartnerDestinationsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1043,7 +1054,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1059,7 +1069,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1106,7 +1115,7 @@ def activate(
:rtype: ~azure.mgmt.eventgrid.models.PartnerDestination
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1128,7 +1137,6 @@ def activate(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1143,7 +1151,7 @@ def activate(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerDestination", pipeline_response)
+ deserialized = self._deserialize("PartnerDestination", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_namespaces_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_namespaces_operations.py
index c42f1193cba2..db59e258d02d 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_namespaces_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +50,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -76,7 +81,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -110,7 +115,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -141,7 +146,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -175,7 +180,7 @@ def build_list_by_subscription_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -210,7 +215,7 @@ def build_list_by_resource_group_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -244,7 +249,7 @@ def build_list_shared_access_keys_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -275,7 +280,7 @@ def build_regenerate_key_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -337,7 +342,7 @@ def get(self, resource_group_name: str, partner_namespace_name: str, **kwargs: A
:rtype: ~azure.mgmt.eventgrid.models.PartnerNamespace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -359,7 +364,6 @@ def get(self, resource_group_name: str, partner_namespace_name: str, **kwargs: A
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -374,7 +378,7 @@ def get(self, resource_group_name: str, partner_namespace_name: str, **kwargs: A
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerNamespace", pipeline_response)
+ deserialized = self._deserialize("PartnerNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -387,8 +391,8 @@ def _create_or_update_initial(
partner_namespace_name: str,
partner_namespace_info: Union[_models.PartnerNamespace, IO[bytes]],
**kwargs: Any
- ) -> _models.PartnerNamespace:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -401,7 +405,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PartnerNamespace] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -422,10 +426,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -433,11 +437,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerNamespace", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -550,10 +558,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PartnerNamespace", pipeline_response)
+ deserialized = self._deserialize("PartnerNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -575,10 +584,8 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, partner_namespace_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ def _delete_initial(self, resource_group_name: str, partner_namespace_name: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -590,7 +597,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -600,10 +607,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -611,6 +618,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -619,8 +630,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(self, resource_group_name: str, partner_namespace_name: str, **kwargs: Any) -> LROPoller[None]:
@@ -646,7 +661,7 @@ def begin_delete(self, resource_group_name: str, partner_namespace_name: str, **
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
partner_namespace_name=partner_namespace_name,
api_version=api_version,
@@ -655,6 +670,7 @@ def begin_delete(self, resource_group_name: str, partner_namespace_name: str, **
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -682,8 +698,8 @@ def _update_initial(
partner_namespace_name: str,
partner_namespace_update_parameters: Union[_models.PartnerNamespaceUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.PartnerNamespace]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -696,7 +712,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.PartnerNamespace]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -717,10 +733,10 @@ def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -728,13 +744,15 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 201:
- deserialized = self._deserialize("PartnerNamespace", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -849,10 +867,11 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PartnerNamespace", pipeline_response)
+ deserialized = self._deserialize("PartnerNamespace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -904,7 +923,7 @@ def list_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartnerNamespacesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -923,7 +942,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -939,7 +957,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1002,7 +1019,7 @@ def list_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartnerNamespacesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1022,7 +1039,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1038,7 +1054,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1085,7 +1100,7 @@ def list_shared_access_keys(
:rtype: ~azure.mgmt.eventgrid.models.PartnerNamespaceSharedAccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1107,7 +1122,6 @@ def list_shared_access_keys(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1122,7 +1136,7 @@ def list_shared_access_keys(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerNamespaceSharedAccessKeys", pipeline_response)
+ deserialized = self._deserialize("PartnerNamespaceSharedAccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1212,7 +1226,7 @@ def regenerate_key(
:rtype: ~azure.mgmt.eventgrid.models.PartnerNamespaceSharedAccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1246,7 +1260,6 @@ def regenerate_key(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1261,7 +1274,7 @@ def regenerate_key(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerNamespaceSharedAccessKeys", pipeline_response)
+ deserialized = self._deserialize("PartnerNamespaceSharedAccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_registrations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_registrations_operations.py
index e13c7b90f3c2..851b23e019e6 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_registrations_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_registrations_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +50,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -76,7 +81,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -109,7 +114,7 @@ def build_delete_request(
) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
# Construct URL
_url = kwargs.pop(
"template_url",
@@ -135,7 +140,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -169,7 +174,7 @@ def build_list_by_subscription_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -206,7 +211,7 @@ def build_list_by_resource_group_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -270,7 +275,7 @@ def get(
:rtype: ~azure.mgmt.eventgrid.models.PartnerRegistration
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -292,7 +297,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -306,7 +310,7 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerRegistration", pipeline_response)
+ deserialized = self._deserialize("PartnerRegistration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -319,8 +323,8 @@ def _create_or_update_initial(
partner_registration_name: str,
partner_registration_info: Union[_models.PartnerRegistration, IO[bytes]],
**kwargs: Any
- ) -> _models.PartnerRegistration:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -333,7 +337,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PartnerRegistration] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -354,10 +358,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -365,17 +369,18 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("PartnerRegistration", pipeline_response)
-
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
- deserialized = self._deserialize("PartnerRegistration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -488,10 +493,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PartnerRegistration", pipeline_response)
+ deserialized = self._deserialize("PartnerRegistration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -513,10 +519,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self, resource_group_name: str, partner_registration_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -528,7 +534,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -538,10 +544,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -549,6 +555,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -556,8 +566,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(self, resource_group_name: str, partner_registration_name: str, **kwargs: Any) -> LROPoller[None]:
@@ -583,7 +597,7 @@ def begin_delete(self, resource_group_name: str, partner_registration_name: str,
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
partner_registration_name=partner_registration_name,
api_version=api_version,
@@ -592,6 +606,7 @@ def begin_delete(self, resource_group_name: str, partner_registration_name: str,
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -619,8 +634,8 @@ def _update_initial(
partner_registration_name: str,
partner_registration_update_parameters: Union[_models.PartnerRegistrationUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.PartnerRegistration]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -633,7 +648,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.PartnerRegistration]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -654,10 +669,10 @@ def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -665,12 +680,14 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 201:
- deserialized = self._deserialize("PartnerRegistration", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -787,10 +804,11 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PartnerRegistration", pipeline_response)
+ deserialized = self._deserialize("PartnerRegistration", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -842,7 +860,7 @@ def list_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartnerRegistrationsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -861,7 +879,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -877,7 +894,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -939,7 +955,7 @@ def list_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartnerRegistrationsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -959,7 +975,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -975,7 +990,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topic_event_subscriptions_operations.py
index a0f78037ab34..6cb2d219a9a7 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topic_event_subscriptions_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topic_event_subscriptions_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +50,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -77,7 +82,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -111,7 +116,7 @@ def build_delete_request(
) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
# Construct URL
_url = kwargs.pop(
"template_url",
@@ -138,7 +143,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -173,7 +178,7 @@ def build_get_full_url_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -211,7 +216,7 @@ def build_list_by_partner_topic_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -246,7 +251,7 @@ def build_get_delivery_attributes_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -310,7 +315,7 @@ def get(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscription
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -333,7 +338,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -347,7 +351,7 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -361,8 +365,8 @@ def _create_or_update_initial(
event_subscription_name: str,
event_subscription_info: Union[_models.EventSubscription, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -375,7 +379,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -397,10 +401,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -408,14 +412,14 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("EventSubscription", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -549,10 +553,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -574,10 +579,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self, resource_group_name: str, partner_topic_name: str, event_subscription_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -589,7 +594,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -600,10 +605,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -611,6 +616,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -618,8 +627,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -649,7 +662,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
partner_topic_name=partner_topic_name,
event_subscription_name=event_subscription_name,
@@ -659,6 +672,7 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -687,8 +701,8 @@ def _update_initial(
event_subscription_name: str,
event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -701,7 +715,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -723,10 +737,10 @@ def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -734,10 +748,14 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -862,10 +880,11 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -906,7 +925,7 @@ def get_full_url(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -929,7 +948,6 @@ def get_full_url(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -943,7 +961,7 @@ def get_full_url(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response)
+ deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -990,7 +1008,7 @@ def list_by_partner_topic(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1011,7 +1029,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1027,7 +1044,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1075,7 +1091,7 @@ def get_delivery_attributes(
:rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1098,7 +1114,6 @@ def get_delivery_attributes(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1112,7 +1127,7 @@ def get_delivery_attributes(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response)
+ deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topics_operations.py
index a6ce194d46e5..e14e31faa54c 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topics_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_partner_topics_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +50,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -76,7 +81,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -109,7 +114,7 @@ def build_delete_request(
) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
# Construct URL
_url = kwargs.pop(
"template_url",
@@ -135,7 +140,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -169,7 +174,7 @@ def build_list_by_subscription_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -204,7 +209,7 @@ def build_list_by_resource_group_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -238,7 +243,7 @@ def build_activate_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -269,7 +274,7 @@ def build_deactivate_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -328,7 +333,7 @@ def get(self, resource_group_name: str, partner_topic_name: str, **kwargs: Any)
:rtype: ~azure.mgmt.eventgrid.models.PartnerTopic
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -350,7 +355,6 @@ def get(self, resource_group_name: str, partner_topic_name: str, **kwargs: Any)
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -364,7 +368,7 @@ def get(self, resource_group_name: str, partner_topic_name: str, **kwargs: Any)
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerTopic", pipeline_response)
+ deserialized = self._deserialize("PartnerTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -453,7 +457,7 @@ def create_or_update(
:rtype: ~azure.mgmt.eventgrid.models.PartnerTopic
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -487,7 +491,6 @@ def create_or_update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -501,21 +504,15 @@ def create_or_update(
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("PartnerTopic", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PartnerTopic", pipeline_response)
+ deserialized = self._deserialize("PartnerTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
- def _delete_initial( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, partner_topic_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ def _delete_initial(self, resource_group_name: str, partner_topic_name: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -527,7 +524,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -537,10 +534,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -548,6 +545,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -555,8 +556,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(self, resource_group_name: str, partner_topic_name: str, **kwargs: Any) -> LROPoller[None]:
@@ -582,7 +587,7 @@ def begin_delete(self, resource_group_name: str, partner_topic_name: str, **kwar
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
partner_topic_name=partner_topic_name,
api_version=api_version,
@@ -591,6 +596,7 @@ def begin_delete(self, resource_group_name: str, partner_topic_name: str, **kwar
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -696,7 +702,7 @@ def update(
:rtype: ~azure.mgmt.eventgrid.models.PartnerTopic or None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -730,7 +736,6 @@ def update(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -746,7 +751,7 @@ def update(
deserialized = None
if response.status_code == 201:
- deserialized = self._deserialize("PartnerTopic", pipeline_response)
+ deserialized = self._deserialize("PartnerTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -783,7 +788,7 @@ def list_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartnerTopicsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -802,7 +807,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -818,7 +822,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -880,7 +883,7 @@ def list_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PartnerTopicsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -900,7 +903,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -916,7 +918,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -960,7 +961,7 @@ def activate(self, resource_group_name: str, partner_topic_name: str, **kwargs:
:rtype: ~azure.mgmt.eventgrid.models.PartnerTopic
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -982,7 +983,6 @@ def activate(self, resource_group_name: str, partner_topic_name: str, **kwargs:
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -996,7 +996,7 @@ def activate(self, resource_group_name: str, partner_topic_name: str, **kwargs:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerTopic", pipeline_response)
+ deserialized = self._deserialize("PartnerTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1018,7 +1018,7 @@ def deactivate(self, resource_group_name: str, partner_topic_name: str, **kwargs
:rtype: ~azure.mgmt.eventgrid.models.PartnerTopic
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1040,7 +1040,6 @@ def deactivate(self, resource_group_name: str, partner_topic_name: str, **kwargs
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1054,7 +1053,7 @@ def deactivate(self, resource_group_name: str, partner_topic_name: str, **kwargs
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PartnerTopic", pipeline_response)
+ deserialized = self._deserialize("PartnerTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_permission_bindings_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_permission_bindings_operations.py
index ff78cb3b2b5c..465a431951ea 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_permission_bindings_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_permission_bindings_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,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +16,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +31,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +49,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -86,7 +90,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -130,7 +134,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -177,7 +181,7 @@ def build_list_by_namespace_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -246,7 +250,7 @@ def get(
:rtype: ~azure.mgmt.eventgrid.models.PermissionBinding
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -269,7 +273,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -284,7 +287,7 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PermissionBinding", pipeline_response)
+ deserialized = self._deserialize("PermissionBinding", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -298,8 +301,8 @@ def _create_or_update_initial(
permission_binding_name: str,
permission_binding_info: Union[_models.PermissionBinding, IO[bytes]],
**kwargs: Any
- ) -> _models.PermissionBinding:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -312,7 +315,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PermissionBinding] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -334,10 +337,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -345,15 +348,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ 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 = self._deserialize("PermissionBinding", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PermissionBinding", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -476,10 +479,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PermissionBinding", pipeline_response)
+ deserialized = self._deserialize("PermissionBinding", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -503,10 +507,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self, resource_group_name: str, namespace_name: str, permission_binding_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -518,7 +522,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -529,10 +533,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -540,6 +544,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -548,8 +556,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -579,7 +591,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
namespace_name=namespace_name,
permission_binding_name=permission_binding_name,
@@ -589,6 +601,7 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -652,7 +665,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PermissionBindingsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -673,7 +686,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -689,7 +701,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_endpoint_connections_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_endpoint_connections_operations.py
index 87b0985fc387..44c0ef02fed8 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_endpoint_connections_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/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.
@@ -7,7 +6,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +16,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +31,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -50,7 +54,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -90,7 +94,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -132,7 +136,7 @@ def build_delete_request(
) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
# Construct URL
_url = kwargs.pop(
"template_url",
@@ -169,7 +173,7 @@ def build_list_by_resource_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -235,9 +239,9 @@ def get(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param parent_type: The type of the parent resource. This can be either \'topics\',
- \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains",
- "partnerNamespaces", and "namespaces". Required.
+ :param parent_type: The type of the parent resource. This can be either \\'topics\\',
+ \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics",
+ "domains", "partnerNamespaces", and "namespaces". Required.
:type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType
:param parent_name: The name of the parent resource (namely, either, the topic name, domain
name, or partner namespace name or namespace name). Required.
@@ -249,7 +253,7 @@ def get(
:rtype: ~azure.mgmt.eventgrid.models.PrivateEndpointConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -273,7 +277,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -287,7 +290,7 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -302,8 +305,8 @@ def _update_initial(
private_endpoint_connection_name: str,
private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]],
**kwargs: Any
- ) -> _models.PrivateEndpointConnection:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -316,7 +319,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -339,10 +342,10 @@ def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -350,14 +353,14 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -383,9 +386,9 @@ def begin_update(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param parent_type: The type of the parent resource. This can be either \'topics\',
- \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains",
- "partnerNamespaces", and "namespaces". Required.
+ :param parent_type: The type of the parent resource. This can be either \\'topics\\',
+ \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics",
+ "domains", "partnerNamespaces", and "namespaces". Required.
:type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType
:param parent_name: The name of the parent resource (namely, either, the topic name, domain
name, or partner namespace name or namespace name). Required.
@@ -423,9 +426,9 @@ def begin_update(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param parent_type: The type of the parent resource. This can be either \'topics\',
- \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains",
- "partnerNamespaces", and "namespaces". Required.
+ :param parent_type: The type of the parent resource. This can be either \\'topics\\',
+ \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics",
+ "domains", "partnerNamespaces", and "namespaces". Required.
:type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType
:param parent_name: The name of the parent resource (namely, either, the topic name, domain
name, or partner namespace name or namespace name). Required.
@@ -461,9 +464,9 @@ def begin_update(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param parent_type: The type of the parent resource. This can be either \'topics\',
- \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains",
- "partnerNamespaces", and "namespaces". Required.
+ :param parent_type: The type of the parent resource. This can be either \\'topics\\',
+ \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics",
+ "domains", "partnerNamespaces", and "namespaces". Required.
:type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType
:param parent_name: The name of the parent resource (namely, either, the topic name, domain
name, or partner namespace name or namespace name). Required.
@@ -503,10 +506,11 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response)
+ deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -528,15 +532,15 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self,
resource_group_name: str,
parent_type: Union[str, _models.PrivateEndpointConnectionsParentType],
parent_name: str,
private_endpoint_connection_name: str,
**kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -548,7 +552,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -560,10 +564,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -571,6 +575,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -578,8 +586,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -598,9 +610,9 @@ def begin_delete(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param parent_type: The type of the parent resource. This can be either \'topics\',
- \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains",
- "partnerNamespaces", and "namespaces". Required.
+ :param parent_type: The type of the parent resource. This can be either \\'topics\\',
+ \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics",
+ "domains", "partnerNamespaces", and "namespaces". Required.
:type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType
:param parent_name: The name of the parent resource (namely, either, the topic name, domain
name, or partner namespace name or namespace name). Required.
@@ -621,7 +633,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
parent_type=parent_type,
parent_name=parent_name,
@@ -632,6 +644,7 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -670,9 +683,9 @@ def list_by_resource(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param parent_type: The type of the parent resource. This can be either \'topics\',
- \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Known values are: "topics", "domains",
- "partnerNamespaces", and "namespaces". Required.
+ :param parent_type: The type of the parent resource. This can be either \\'topics\\',
+ \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Known values are: "topics",
+ "domains", "partnerNamespaces", and "namespaces". Required.
:type parent_type: str or ~azure.mgmt.eventgrid.models.PrivateEndpointConnectionsParentType
:param parent_name: The name of the parent resource (namely, either, the topic name, domain
name, or partner namespace name or namespace name). Required.
@@ -700,7 +713,7 @@ def list_by_resource(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -722,7 +735,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -738,7 +750,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_link_resources_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_link_resources_operations.py
index 3d44a225f4de..e9b13311aefb 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_private_link_resources_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/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.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -47,7 +49,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -87,7 +89,7 @@ def build_list_by_resource_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -152,8 +154,8 @@ def get(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param parent_type: The type of the parent resource. This can be either \'topics\',
- \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Required.
+ :param parent_type: The type of the parent resource. This can be either \\'topics\\',
+ \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Required.
:type parent_type: str
:param parent_name: The name of the parent resource (namely, either, the topic name, domain
name, or partner namespace name or namespace name). Required.
@@ -165,7 +167,7 @@ def get(
:rtype: ~azure.mgmt.eventgrid.models.PrivateLinkResource
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -189,7 +191,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -203,7 +204,7 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("PrivateLinkResource", pipeline_response)
+ deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -227,8 +228,8 @@ def list_by_resource(
:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
- :param parent_type: The type of the parent resource. This can be either \'topics\',
- \'domains\', or \'partnerNamespaces\' or \'namespaces\'. Required.
+ :param parent_type: The type of the parent resource. This can be either \\'topics\\',
+ \\'domains\\', or \\'partnerNamespaces\\' or \\'namespaces\\'. Required.
:type parent_type: str
:param parent_name: The name of the parent resource (namely, either, the topic name, domain
name, or partner namespace or namespace name). Required.
@@ -255,7 +256,7 @@ def list_by_resource(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateLinkResourcesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -277,7 +278,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -293,7 +293,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topic_event_subscriptions_operations.py
index c0aeff3e6e02..ef3aa889fc52 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topic_event_subscriptions_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topic_event_subscriptions_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +50,7 @@ def build_get_delivery_attributes_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -77,7 +82,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -109,7 +114,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -143,7 +148,7 @@ def build_delete_request(
) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
# Construct URL
_url = kwargs.pop(
"template_url",
@@ -170,7 +175,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -205,7 +210,7 @@ def build_get_full_url_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -243,7 +248,7 @@ def build_list_by_system_topic_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -310,7 +315,7 @@ def get_delivery_attributes(
:rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -333,7 +338,6 @@ def get_delivery_attributes(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -347,7 +351,7 @@ def get_delivery_attributes(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response)
+ deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -373,7 +377,7 @@ def get(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscription
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -396,7 +400,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -410,7 +413,7 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -424,8 +427,8 @@ def _create_or_update_initial(
event_subscription_name: str,
event_subscription_info: Union[_models.EventSubscription, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -438,7 +441,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -460,10 +463,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -471,10 +474,14 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -608,10 +615,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -633,10 +641,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self, resource_group_name: str, system_topic_name: str, event_subscription_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -648,7 +656,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -659,10 +667,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -670,6 +678,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -677,8 +689,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -708,7 +724,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
system_topic_name=system_topic_name,
event_subscription_name=event_subscription_name,
@@ -718,6 +734,7 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -746,8 +763,8 @@ def _update_initial(
event_subscription_name: str,
event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -760,7 +777,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -782,10 +799,10 @@ def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -793,10 +810,14 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -921,10 +942,11 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -965,7 +987,7 @@ def get_full_url(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -988,7 +1010,6 @@ def get_full_url(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1002,7 +1023,7 @@ def get_full_url(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response)
+ deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1049,7 +1070,7 @@ def list_by_system_topic(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1070,7 +1091,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1086,7 +1106,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py
index 23da48b6116c..1003b910951e 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_system_topics_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +50,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -76,7 +81,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -109,7 +114,7 @@ def build_delete_request(
) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
# Construct URL
_url = kwargs.pop(
"template_url",
@@ -135,7 +140,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -169,7 +174,7 @@ def build_list_by_subscription_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -204,7 +209,7 @@ def build_list_by_resource_group_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -266,7 +271,7 @@ def get(self, resource_group_name: str, system_topic_name: str, **kwargs: Any) -
:rtype: ~azure.mgmt.eventgrid.models.SystemTopic
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -288,7 +293,6 @@ def get(self, resource_group_name: str, system_topic_name: str, **kwargs: Any) -
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -302,7 +306,7 @@ def get(self, resource_group_name: str, system_topic_name: str, **kwargs: Any) -
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("SystemTopic", pipeline_response)
+ deserialized = self._deserialize("SystemTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -315,8 +319,8 @@ def _create_or_update_initial(
system_topic_name: str,
system_topic_info: Union[_models.SystemTopic, IO[bytes]],
**kwargs: Any
- ) -> _models.SystemTopic:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -329,7 +333,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.SystemTopic] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -350,10 +354,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -361,14 +365,14 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("SystemTopic", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SystemTopic", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -481,10 +485,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("SystemTopic", pipeline_response)
+ deserialized = self._deserialize("SystemTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -506,10 +511,8 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, system_topic_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ def _delete_initial(self, resource_group_name: str, system_topic_name: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -521,7 +524,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -531,10 +534,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -542,6 +545,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -549,8 +556,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(self, resource_group_name: str, system_topic_name: str, **kwargs: Any) -> LROPoller[None]:
@@ -576,7 +587,7 @@ def begin_delete(self, resource_group_name: str, system_topic_name: str, **kwarg
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
system_topic_name=system_topic_name,
api_version=api_version,
@@ -585,6 +596,7 @@ def begin_delete(self, resource_group_name: str, system_topic_name: str, **kwarg
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -612,8 +624,8 @@ def _update_initial(
system_topic_name: str,
system_topic_update_parameters: Union[_models.SystemTopicUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.SystemTopic:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -626,7 +638,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.SystemTopic] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -647,10 +659,10 @@ def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -658,14 +670,14 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("SystemTopic", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("SystemTopic", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -779,10 +791,11 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("SystemTopic", pipeline_response)
+ deserialized = self._deserialize("SystemTopic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -834,7 +847,7 @@ def list_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.SystemTopicsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -853,7 +866,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -869,7 +881,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -931,7 +942,7 @@ def list_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.SystemTopicsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -951,7 +962,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -967,7 +977,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_event_subscriptions_operations.py
index ddff0b6190c3..7dc172deef99 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_event_subscriptions_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_event_subscriptions_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +50,7 @@ def build_get_delivery_attributes_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -77,7 +82,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -109,7 +114,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -143,7 +148,7 @@ def build_delete_request(
) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
# Construct URL
_url = kwargs.pop(
"template_url",
@@ -170,7 +175,7 @@ def build_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -205,7 +210,7 @@ def build_get_full_url_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -243,7 +248,7 @@ def build_list_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -310,7 +315,7 @@ def get_delivery_attributes(
:rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -333,7 +338,6 @@ def get_delivery_attributes(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -347,7 +351,7 @@ def get_delivery_attributes(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response)
+ deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -373,7 +377,7 @@ def get(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscription
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -396,7 +400,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -410,7 +413,7 @@ def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -424,8 +427,8 @@ def _create_or_update_initial(
event_subscription_name: str,
event_subscription_info: Union[_models.EventSubscription, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -438,7 +441,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -460,10 +463,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -471,14 +474,14 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- if response.status_code == 200:
- deserialized = self._deserialize("EventSubscription", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -609,10 +612,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -634,10 +638,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self, resource_group_name: str, topic_name: str, event_subscription_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -649,7 +653,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -660,10 +664,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -671,6 +675,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -678,8 +686,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -709,7 +721,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
topic_name=topic_name,
event_subscription_name=event_subscription_name,
@@ -719,6 +731,7 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -747,8 +760,8 @@ def _update_initial(
event_subscription_name: str,
event_subscription_update_parameters: Union[_models.EventSubscriptionUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> _models.EventSubscription:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -761,7 +774,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.EventSubscription] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -783,10 +796,10 @@ def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -794,10 +807,14 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -922,10 +939,11 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("EventSubscription", pipeline_response)
+ deserialized = self._deserialize("EventSubscription", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -966,7 +984,7 @@ def get_full_url(
:rtype: ~azure.mgmt.eventgrid.models.EventSubscriptionFullUrl
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -989,7 +1007,6 @@ def get_full_url(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1003,7 +1020,7 @@ def get_full_url(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response)
+ deserialized = self._deserialize("EventSubscriptionFullUrl", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1050,7 +1067,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventSubscriptionsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1071,7 +1088,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1087,7 +1103,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_spaces_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_spaces_operations.py
index 1f931c1c7805..0355ff1375eb 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_spaces_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_spaces_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,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +16,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +31,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -45,7 +49,7 @@ def build_get_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -81,7 +85,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -120,7 +124,7 @@ def build_delete_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -162,7 +166,7 @@ def build_list_by_namespace_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -231,7 +235,7 @@ def get(
:rtype: ~azure.mgmt.eventgrid.models.TopicSpace
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -254,7 +258,6 @@ def get(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -269,7 +272,7 @@ def get(
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
- deserialized = self._deserialize("TopicSpace", pipeline_response)
+ deserialized = self._deserialize("TopicSpace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -283,8 +286,8 @@ def _create_or_update_initial(
topic_space_name: str,
topic_space_info: Union[_models.TopicSpace, IO[bytes]],
**kwargs: Any
- ) -> _models.TopicSpace:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -297,7 +300,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.TopicSpace] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -319,10 +322,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -330,15 +333,15 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ 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 = self._deserialize("TopicSpace", pipeline_response)
-
- if response.status_code == 201:
- deserialized = self._deserialize("TopicSpace", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -458,10 +461,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("TopicSpace", pipeline_response)
+ deserialized = self._deserialize("TopicSpace", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -485,10 +489,10 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
+ def _delete_initial(
self, resource_group_name: str, namespace_name: str, topic_space_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -500,7 +504,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -511,10 +515,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -522,6 +526,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
@@ -530,8 +538,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(
@@ -561,7 +573,7 @@ def begin_delete(
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
namespace_name=namespace_name,
topic_space_name=topic_space_name,
@@ -571,6 +583,7 @@ def begin_delete(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -634,7 +647,7 @@ def list_by_namespace(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TopicSpacesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -655,7 +668,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -671,7 +683,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_types_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_types_operations.py
index 5c0e9876c2d0..4dfe223ee385 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_types_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topic_types_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -40,7 +42,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -59,7 +61,7 @@ def build_get_request(topic_type_name: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -83,7 +85,7 @@ def build_list_event_types_request(topic_type_name: str, **kwargs: Any) -> HttpR
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -138,7 +140,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.TopicTypeInfo"]:
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TopicTypesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -154,7 +156,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -170,7 +171,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -211,7 +211,7 @@ def get(self, topic_type_name: str, **kwargs: Any) -> _models.TopicTypeInfo:
:rtype: ~azure.mgmt.eventgrid.models.TopicTypeInfo
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -231,7 +231,6 @@ def get(self, topic_type_name: str, **kwargs: Any) -> _models.TopicTypeInfo:
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -245,7 +244,7 @@ def get(self, topic_type_name: str, **kwargs: Any) -> _models.TopicTypeInfo:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("TopicTypeInfo", pipeline_response)
+ deserialized = self._deserialize("TopicTypeInfo", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -270,7 +269,7 @@ def list_event_types(self, topic_type_name: str, **kwargs: Any) -> Iterable["_mo
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventTypesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -287,7 +286,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -303,7 +301,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topics_operations.py
index bbc051e8c748..f42677456b94 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topics_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_topics_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.
@@ -7,7 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
-from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
+import sys
+from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
@@ -16,13 +17,14 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
+ StreamClosedError,
+ StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
@@ -30,8 +32,11 @@
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -43,7 +48,7 @@ def build_get_request(resource_group_name: str, topic_name: str, subscription_id
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -74,7 +79,7 @@ def build_create_or_update_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -105,7 +110,7 @@ def build_create_or_update_request(
def build_delete_request(resource_group_name: str, topic_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
# Construct URL
_url = kwargs.pop(
"template_url",
@@ -129,7 +134,7 @@ def build_update_request(resource_group_name: str, topic_name: str, subscription
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -163,7 +168,7 @@ def build_list_by_subscription_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -198,7 +203,7 @@ def build_list_by_resource_group_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -232,7 +237,7 @@ def build_list_shared_access_keys_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -263,7 +268,7 @@ def build_regenerate_key_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
@@ -302,7 +307,7 @@ def build_list_event_types_request(
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -363,7 +368,7 @@ def get(self, resource_group_name: str, topic_name: str, **kwargs: Any) -> _mode
:rtype: ~azure.mgmt.eventgrid.models.Topic
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -385,7 +390,6 @@ def get(self, resource_group_name: str, topic_name: str, **kwargs: Any) -> _mode
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -399,7 +403,7 @@ def get(self, resource_group_name: str, topic_name: str, **kwargs: Any) -> _mode
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Topic", pipeline_response)
+ deserialized = self._deserialize("Topic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -408,8 +412,8 @@ def get(self, resource_group_name: str, topic_name: str, **kwargs: Any) -> _mode
def _create_or_update_initial(
self, resource_group_name: str, topic_name: str, topic_info: Union[_models.Topic, IO[bytes]], **kwargs: Any
- ) -> _models.Topic:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -422,7 +426,7 @@ def _create_or_update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[_models.Topic] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -443,10 +447,10 @@ def _create_or_update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -454,10 +458,14 @@ def _create_or_update_initial(
response = pipeline_response.http_response
if response.status_code not in [201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("Topic", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -562,10 +570,11 @@ def begin_create_or_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Topic", pipeline_response)
+ deserialized = self._deserialize("Topic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -587,10 +596,8 @@ def get_long_running_output(pipeline_response):
self._client, raw_result, get_long_running_output, polling_method # type: ignore
)
- def _delete_initial( # pylint: disable=inconsistent-return-statements
- self, resource_group_name: str, topic_name: str, **kwargs: Any
- ) -> None:
- error_map = {
+ def _delete_initial(self, resource_group_name: str, topic_name: str, **kwargs: Any) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -602,7 +609,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
- cls: ClsType[None] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
_request = build_delete_request(
resource_group_name=resource_group_name,
@@ -612,10 +619,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -623,6 +630,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
@@ -630,8 +641,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
- return cls(pipeline_response, None, response_headers) # type: ignore
+ return cls(pipeline_response, deserialized, response_headers) # type: ignore
+
+ return deserialized # type: ignore
@distributed_trace
def begin_delete(self, resource_group_name: str, topic_name: str, **kwargs: Any) -> LROPoller[None]:
@@ -657,7 +672,7 @@ def begin_delete(self, resource_group_name: str, topic_name: str, **kwargs: Any)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
- raw_result = self._delete_initial( # type: ignore
+ raw_result = self._delete_initial(
resource_group_name=resource_group_name,
topic_name=topic_name,
api_version=api_version,
@@ -666,6 +681,7 @@ def begin_delete(self, resource_group_name: str, topic_name: str, **kwargs: Any)
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
@@ -693,8 +709,8 @@ def _update_initial(
topic_name: str,
topic_update_parameters: Union[_models.TopicUpdateParameters, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.Topic]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -707,7 +723,7 @@ def _update_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.Topic]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -728,10 +744,10 @@ def _update_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -739,12 +755,14 @@ def _update_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = None
- if response.status_code == 201:
- deserialized = self._deserialize("Topic", pipeline_response)
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -854,10 +872,11 @@ def begin_update(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("Topic", pipeline_response)
+ deserialized = self._deserialize("Topic", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -909,7 +928,7 @@ def list_by_subscription(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TopicsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -928,7 +947,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -944,7 +962,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1006,7 +1023,7 @@ def list_by_resource_group(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.TopicsListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1026,7 +1043,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1042,7 +1058,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
@@ -1088,7 +1103,7 @@ def list_shared_access_keys(
:rtype: ~azure.mgmt.eventgrid.models.TopicSharedAccessKeys
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1110,7 +1125,6 @@ def list_shared_access_keys(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -1124,7 +1138,7 @@ def list_shared_access_keys(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response)
+ deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -1137,8 +1151,8 @@ def _regenerate_key_initial(
topic_name: str,
regenerate_key_request: Union[_models.TopicRegenerateKeyRequest, IO[bytes]],
**kwargs: Any
- ) -> Optional[_models.TopicSharedAccessKeys]:
- error_map = {
+ ) -> Iterator[bytes]:
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1151,7 +1165,7 @@ def _regenerate_key_initial(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
- cls: ClsType[Optional[_models.TopicSharedAccessKeys]] = kwargs.pop("cls", None)
+ cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
@@ -1172,10 +1186,10 @@ def _regenerate_key_initial(
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
- _stream = False
+ _decompress = kwargs.pop("decompress", True)
+ _stream = True
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)
@@ -1183,17 +1197,19 @@ def _regenerate_key_initial(
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
+ try:
+ response.read() # Load the body in memory and close the socket
+ except (StreamConsumedError, StreamClosedError):
+ pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = None
response_headers = {}
- if response.status_code == 200:
- deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response)
-
if response.status_code == 202:
response_headers["Location"] = self._deserialize("str", response.headers.get("Location"))
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
+
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1306,10 +1322,11 @@ def begin_regenerate_key(
params=_params,
**kwargs
)
+ raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
- deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response)
+ deserialized = self._deserialize("TopicSharedAccessKeys", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized
@@ -1363,7 +1380,7 @@ def list_event_types(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.EventTypesListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1384,7 +1401,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -1400,7 +1416,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_verified_partners_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_verified_partners_operations.py
index d8f7c10ad09a..d844f8637e3d 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_verified_partners_operations.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/operations/_verified_partners_operations.py
@@ -1,4 +1,3 @@
-# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6,6 +5,7 @@
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
+import sys
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
@@ -19,16 +19,18 @@
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
-from azure.core.pipeline.transport import HttpResponse
-from azure.core.rest import HttpRequest
+from azure.core.rest import HttpRequest, HttpResponse
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
-from .._vendor import _convert_request
+if sys.version_info >= (3, 9):
+ from collections.abc import MutableMapping
+else:
+ from typing import MutableMapping # type: ignore
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -40,7 +42,7 @@ def build_get_request(verified_partner_name: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -64,7 +66,7 @@ def build_list_request(*, filter: Optional[str] = None, top: Optional[int] = Non
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
- api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview"))
+ api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-15-preview"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
@@ -114,7 +116,7 @@ def get(self, verified_partner_name: str, **kwargs: Any) -> _models.VerifiedPart
:rtype: ~azure.mgmt.eventgrid.models.VerifiedPartner
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -134,7 +136,6 @@ def get(self, verified_partner_name: str, **kwargs: Any) -> _models.VerifiedPart
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_stream = False
@@ -148,7 +149,7 @@ def get(self, verified_partner_name: str, **kwargs: Any) -> _models.VerifiedPart
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
- deserialized = self._deserialize("VerifiedPartner", pipeline_response)
+ deserialized = self._deserialize("VerifiedPartner", pipeline_response.http_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
@@ -185,7 +186,7 @@ def list(
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.VerifiedPartnersListResult] = kwargs.pop("cls", None)
- error_map = {
+ error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -203,7 +204,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
else:
@@ -219,7 +219,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
- _request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_create_or_update.py
index afdaa054f508..86c62b389f76 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_create_or_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.eventgrid import EventGridManagementClient
@@ -46,6 +44,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/CaCertificates_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/CaCertificates_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_delete.py
index 4e882eb7e5a9..f9b7ade4d765 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_delete.py
@@ -37,6 +37,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/CaCertificates_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/CaCertificates_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_get.py
index fc43d7a2a108..6e78b9e054c1 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_get.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/CaCertificates_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/CaCertificates_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_list_by_namespace.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_list_by_namespace.py
index 80e854aa8013..8a171b65e6cd 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_list_by_namespace.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/ca_certificates_list_by_namespace.py
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/CaCertificates_ListByNamespace.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/CaCertificates_ListByNamespace.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_create_or_update.py
index 801272deb41d..5f3b8d1c507d 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_create_or_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.eventgrid import EventGridManagementClient
@@ -53,6 +51,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Channels_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Channels_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_delete.py
index 60e6d104a04b..ed78bee52b48 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_delete.py
@@ -37,6 +37,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Channels_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Channels_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_get.py
index 1cb34fa49040..d1e603c7d563 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_get.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Channels_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Channels_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_get_full_url.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_get_full_url.py
index 5550e19f372c..5b504c9109df 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_get_full_url.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_get_full_url.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Channels_GetFullUrl.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Channels_GetFullUrl.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_list_by_partner_namespace.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_list_by_partner_namespace.py
index a9b477d43028..8892c5e2443b 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_list_by_partner_namespace.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_list_by_partner_namespace.py
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Channels_ListByPartnerNamespace.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Channels_ListByPartnerNamespace.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_update.py
index 66204cbd5dba..e0e35007b1e8 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/channels_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.eventgrid import EventGridManagementClient
@@ -40,6 +38,6 @@ def main():
)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Channels_Update.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Channels_Update.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_create_or_update.py
index b1e7c5d2f384..e7a4934ad556 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_create_or_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.eventgrid import EventGridManagementClient
@@ -43,6 +41,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/ClientGroups_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/ClientGroups_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_delete.py
index 8bf37ce0a9d1..8388e83be7a4 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_delete.py
@@ -37,6 +37,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/ClientGroups_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/ClientGroups_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_get.py
index cfcf43d62288..43392041f30f 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_get.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/ClientGroups_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/ClientGroups_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_list_by_namespace.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_list_by_namespace.py
index 1beb30c03eaa..8c8d0c43dfb5 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_list_by_namespace.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/client_groups_list_by_namespace.py
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/ClientGroups_ListByNamespace.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/ClientGroups_ListByNamespace.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_create_or_update.py
index dfa704641b7e..4696ff4ec4a4 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_create_or_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.eventgrid import EventGridManagementClient
@@ -48,6 +46,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Clients_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Clients_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_delete.py
index 064496815e32..9b1496757909 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_delete.py
@@ -37,6 +37,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Clients_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Clients_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_get.py
index 890159d80f36..a8328526b8ae 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_get.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Clients_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Clients_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_list_by_namespace.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_list_by_namespace.py
index f8e23762a1d1..6534069ad4d4 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_list_by_namespace.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/clients_list_by_namespace.py
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Clients_ListByNamespace.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Clients_ListByNamespace.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_create_or_update.py
index 18c3bf41c576..7ceee72d2f66 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_create_or_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.eventgrid import EventGridManagementClient
@@ -53,6 +51,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainEventSubscriptions_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/DomainEventSubscriptions_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_delete.py
index f26770e2f62d..0ea43013b78b 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_delete.py
@@ -37,6 +37,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainEventSubscriptions_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/DomainEventSubscriptions_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get.py
index 763e1e67ad70..55af3728cfe6 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainEventSubscriptions_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/DomainEventSubscriptions_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get_delivery_attributes.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get_delivery_attributes.py
index 12df13cfa5d9..5c077bbfce99 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get_delivery_attributes.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get_delivery_attributes.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainEventSubscriptions_GetDeliveryAttributes.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/DomainEventSubscriptions_GetDeliveryAttributes.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get_full_url.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get_full_url.py
index 172dbbe7349e..c622e1e9d11f 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get_full_url.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_get_full_url.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainEventSubscriptions_GetFullUrl.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/DomainEventSubscriptions_GetFullUrl.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_list.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_list.py
index e0ccc3f698a0..3e5b73f7e08b 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_list.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_list.py
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainEventSubscriptions_List.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/DomainEventSubscriptions_List.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_update.py
index b9d5931a01ad..5fd430288938 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_event_subscriptions_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.eventgrid import EventGridManagementClient
@@ -49,6 +47,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainEventSubscriptions_Update.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/DomainEventSubscriptions_Update.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_create_or_update.py
index bcd3a4860f23..f5dba52ec5e7 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_create_or_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.eventgrid import EventGridManagementClient
@@ -54,6 +52,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopicEventSubscriptions_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/DomainTopicEventSubscriptions_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_delete.py
index 22db1b809f32..5f733ba9e373 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_delete.py
@@ -38,6 +38,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopicEventSubscriptions_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/DomainTopicEventSubscriptions_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get.py
index 5302ced1e526..2d736a9d58e0 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get.py
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopicEventSubscriptions_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/DomainTopicEventSubscriptions_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get_delivery_attributes.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get_delivery_attributes.py
index dfa1293961e4..ed7d9d961387 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get_delivery_attributes.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get_delivery_attributes.py
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopicEventSubscriptions_GetDeliveryAttributes.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/DomainTopicEventSubscriptions_GetDeliveryAttributes.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get_full_url.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get_full_url.py
index 3d98ace751e4..febf08e05329 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get_full_url.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_get_full_url.py
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopicEventSubscriptions_GetFullUrl.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/DomainTopicEventSubscriptions_GetFullUrl.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_list.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_list.py
index d12d74fa35d3..08b29a7727a1 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_list.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_list.py
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopicEventSubscriptions_List.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/DomainTopicEventSubscriptions_List.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_update.py
index c258666fc71e..cdd6d3ec749e 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topic_event_subscriptions_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.eventgrid import EventGridManagementClient
@@ -50,6 +48,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopicEventSubscriptions_Update.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/DomainTopicEventSubscriptions_Update.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_create_or_update.py
index 36d492d17a2f..07acc9c741ca 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_create_or_update.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopics_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/DomainTopics_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_delete.py
index b1d067ec806b..eed65c7cbb5f 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_delete.py
@@ -37,6 +37,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopics_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/DomainTopics_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_get.py
index b89f065d44d3..4d70404081e8 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_get.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopics_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/DomainTopics_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_list_by_domain.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_list_by_domain.py
index 6ca1e08f0a92..751734ad5653 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_list_by_domain.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domain_topics_list_by_domain.py
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/DomainTopics_ListByDomain.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/DomainTopics_ListByDomain.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_create_or_update.py
index 4e94fcf98dd5..38b1d19f6dac 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_create_or_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.eventgrid import EventGridManagementClient
@@ -50,6 +48,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Domains_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Domains_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_delete.py
index efdb05c41ae2..05dafcebb4c4 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_delete.py
@@ -36,6 +36,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Domains_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Domains_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_get.py
index bd7c1aa27465..172ae2b66cf1 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_get.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Domains_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Domains_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_by_resource_group.py
index aaf30fbf44a0..142985c066a3 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_by_resource_group.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_by_resource_group.py
@@ -37,6 +37,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Domains_ListByResourceGroup.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Domains_ListByResourceGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_by_subscription.py
index 63c57ad3d365..e1ec46106c44 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_by_subscription.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_by_subscription.py
@@ -35,6 +35,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Domains_ListBySubscription.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Domains_ListBySubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_shared_access_keys.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_shared_access_keys.py
index ada61320b039..eb596d6c7046 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_shared_access_keys.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_list_shared_access_keys.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Domains_ListSharedAccessKeys.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Domains_ListSharedAccessKeys.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_regenerate_key.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_regenerate_key.py
index 01cb8758e161..39c9c1a20c35 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_regenerate_key.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_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.eventgrid import EventGridManagementClient
@@ -40,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Domains_RegenerateKey.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Domains_RegenerateKey.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_update.py
index 617427b6e4de..e6aad3037edc 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/domains_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.eventgrid import EventGridManagementClient
@@ -49,6 +47,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Domains_Update.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Domains_Update.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic.py
index ac4b2d899864..404eb955e0e9 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic.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.eventgrid import EventGridManagementClient
@@ -54,6 +52,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_azure_function_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_azure_function_destination.py
index d91d9503b71e..248292e87360 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_azure_function_destination.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_azure_function_destination.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
@@ -61,6 +59,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_AzureFunctionDestination.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_AzureFunctionDestination.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_event_hub_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_event_hub_destination.py
index da0589305bf0..cee1100068e3 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_event_hub_destination.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_event_hub_destination.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
@@ -61,6 +59,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_EventHubDestination.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_EventHubDestination.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_hybrid_connection_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_hybrid_connection_destination.py
index a173f74e38c5..e66dec0cd3d4 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_hybrid_connection_destination.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_hybrid_connection_destination.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
@@ -61,6 +59,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_HybridConnectionDestination.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_HybridConnectionDestination.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_service_bus_queue_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_service_bus_queue_destination.py
index 1aedd1a57c83..2e04c08474a9 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_service_bus_queue_destination.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_service_bus_queue_destination.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
@@ -61,6 +59,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusQueueDestination.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusQueueDestination.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_service_bus_topic_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_service_bus_topic_destination.py
index af6298eac124..6f2b6d02f3c6 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_service_bus_topic_destination.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_service_bus_topic_destination.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
@@ -61,6 +59,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusTopicDestination.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_ServiceBusTopicDestination.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_storage_queue_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_storage_queue_destination.py
index 14e2347d5cc3..411436dce0f6 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_storage_queue_destination.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_storage_queue_destination.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
@@ -63,6 +61,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_StorageQueueDestination.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_StorageQueueDestination.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_webhook_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_webhook_destination.py
index 2a579c204791..61e320b38e80 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_webhook_destination.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_custom_topic_webhook_destination.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
@@ -54,6 +52,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_WebhookDestination.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_CreateOrUpdateForCustomTopic_WebhookDestination.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_resource.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_resource.py
index 6f92a40ed2f9..8822a3c81487 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_resource.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_resource.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.eventgrid import EventGridManagementClient
@@ -52,6 +50,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForResource.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_CreateOrUpdateForResource.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_resource_group.py
index 7c53cc127c42..8e0067875ae3 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_resource_group.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_resource_group.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.eventgrid import EventGridManagementClient
@@ -52,6 +50,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForResourceGroup.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_CreateOrUpdateForResourceGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_subscription.py
index d0bace5a713e..730a2f42329d 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_subscription.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_create_or_update_for_subscription.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.eventgrid import EventGridManagementClient
@@ -48,6 +46,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_CreateOrUpdateForSubscription.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_CreateOrUpdateForSubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_custom_topic.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_custom_topic.py
index 3d0f076533a1..68e12ffee679 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_custom_topic.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_custom_topic.py
@@ -36,6 +36,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_DeleteForCustomTopic.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_DeleteForCustomTopic.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_resource.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_resource.py
index fd955ebab918..3451ab078d69 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_resource.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_resource.py
@@ -36,6 +36,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_DeleteForResource.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_DeleteForResource.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_resource_group.py
index b54e8ca6a2b0..6fb6b1a282ac 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_resource_group.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_resource_group.py
@@ -36,6 +36,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_DeleteForResourceGroup.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_DeleteForResourceGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_subscription.py
index 279077d81ca6..71b525c4cc8d 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_subscription.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_delete_for_subscription.py
@@ -36,6 +36,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_DeleteForSubscription.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_DeleteForSubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_delivery_attributes.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_delivery_attributes.py
index 9d18f91c10a8..c8af17d57eaa 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_delivery_attributes.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_delivery_attributes.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetDeliveryAttributes.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_GetDeliveryAttributes.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic.py
index 84ff68d157b6..9232b7b19485 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForCustomTopic.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_GetForCustomTopic.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_azure_function_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_azure_function_destination.py
index ee5b650e1276..f9587df8e2ab 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_azure_function_destination.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_azure_function_destination.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_AzureFunctionDestination.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_GetForCustomTopic_AzureFunctionDestination.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_event_hub_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_event_hub_destination.py
index 395691fff266..2894ae971a49 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_event_hub_destination.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_event_hub_destination.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_EventHubDestination.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_GetForCustomTopic_EventHubDestination.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_hybrid_connection_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_hybrid_connection_destination.py
index e42c24ccab9b..369e8dde6157 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_hybrid_connection_destination.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_hybrid_connection_destination.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_HybridConnectionDestination.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_GetForCustomTopic_HybridConnectionDestination.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_service_bus_queue_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_service_bus_queue_destination.py
index 7cfc389efdb4..745e601929d1 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_service_bus_queue_destination.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_service_bus_queue_destination.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_ServiceBusQueueDestination.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_GetForCustomTopic_ServiceBusQueueDestination.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_service_bus_topic_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_service_bus_topic_destination.py
index 3458c5036516..c8c49cb87fcb 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_service_bus_topic_destination.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_service_bus_topic_destination.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_ServiceBusTopicDestination.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_GetForCustomTopic_ServiceBusTopicDestination.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_storage_queue_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_storage_queue_destination.py
index f2633e3b02cd..bac69c395807 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_storage_queue_destination.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_storage_queue_destination.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_StorageQueueDestination.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_GetForCustomTopic_StorageQueueDestination.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_webhook_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_webhook_destination.py
index 0abf5b9614be..a1e0db19168c 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_webhook_destination.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_custom_topic_webhook_destination.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForCustomTopic_WebhookDestination.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_GetForCustomTopic_WebhookDestination.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_resource.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_resource.py
index 77d7fde02bfd..e44344c79f1d 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_resource.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_resource.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForResource.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_GetForResource.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_resource_group.py
index 20be22e2fb29..8c3457c631ba 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_resource_group.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_resource_group.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForResourceGroup.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_GetForResourceGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_subscription.py
index a1b8bb15ce3b..68842f900566 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_subscription.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_for_subscription.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetForSubscription.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_GetForSubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_custom_topic.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_custom_topic.py
index fb2e0e5b2598..85edc1ed539c 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_custom_topic.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_custom_topic.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetFullUrlForCustomTopic.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_GetFullUrlForCustomTopic.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_resource.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_resource.py
index ebfc57bfac49..14e682c1eb15 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_resource.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_resource.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetFullUrlForResource.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_GetFullUrlForResource.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_resource_group.py
index f944ef5f2e64..db982397ece8 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_resource_group.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_resource_group.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetFullUrlForResourceGroup.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_GetFullUrlForResourceGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_subscription.py
index 28625bcb6a39..b8bff24dd6ed 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_subscription.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_get_full_url_for_subscription.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_GetFullUrlForSubscription.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_GetFullUrlForSubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_by_domain_topic.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_by_domain_topic.py
index 0cf82cd7555d..169cd97a48e9 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_by_domain_topic.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_by_domain_topic.py
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_ListByDomainTopic.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_ListByDomainTopic.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_by_resource.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_by_resource.py
index 98427f3d6e84..21e956d7751a 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_by_resource.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_by_resource.py
@@ -40,6 +40,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_ListByResource.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_ListByResource.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_resource_group.py
index 07e856c0fdb2..106defe78e49 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_resource_group.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_resource_group.py
@@ -37,6 +37,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_ListGlobalByResourceGroup.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_ListGlobalByResourceGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_resource_group_for_topic_type.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_resource_group_for_topic_type.py
index c0173d24f89f..3cc721489445 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_resource_group_for_topic_type.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_resource_group_for_topic_type.py
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_ListGlobalByResourceGroupForTopicType.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_ListGlobalByResourceGroupForTopicType.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_subscription.py
index 40246da98072..9ecc32f95008 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_subscription.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_subscription.py
@@ -35,6 +35,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_ListGlobalBySubscription.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_ListGlobalBySubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_subscription_for_topic_type.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_subscription_for_topic_type.py
index cfec8676e71f..e87b8b935e56 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_subscription_for_topic_type.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_global_by_subscription_for_topic_type.py
@@ -37,6 +37,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_ListGlobalBySubscriptionForTopicType.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_ListGlobalBySubscriptionForTopicType.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_resource_group.py
index db2703bc58b0..1c66903ec9c5 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_resource_group.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_resource_group.py
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_ListRegionalByResourceGroup.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_ListRegionalByResourceGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_resource_group_for_topic_type.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_resource_group_for_topic_type.py
index 0804786c5c26..dcb056cc551e 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_resource_group_for_topic_type.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_resource_group_for_topic_type.py
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_ListRegionalByResourceGroupForTopicType.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_ListRegionalByResourceGroupForTopicType.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_subscription.py
index 3533692d8df2..717a6913607c 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_subscription.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_subscription.py
@@ -37,6 +37,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_ListRegionalBySubscription.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_ListRegionalBySubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_subscription_for_topic_type.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_subscription_for_topic_type.py
index a0860908f4f9..df168e5b12a5 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_subscription_for_topic_type.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_list_regional_by_subscription_for_topic_type.py
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_ListRegionalBySubscriptionForTopicType.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_ListRegionalBySubscriptionForTopicType.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic.py
index 3ae4692ccee8..eef87c9beab0 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic.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.eventgrid import EventGridManagementClient
@@ -48,6 +46,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_UpdateForCustomTopic.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_azure_function_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_azure_function_destination.py
index ca1e053f5967..a67cff6f411f 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_azure_function_destination.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_azure_function_destination.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
@@ -59,6 +57,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic_AzureFunctionDestination.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_UpdateForCustomTopic_AzureFunctionDestination.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_event_hub_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_event_hub_destination.py
index c5b5c5e00ece..491186f56742 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_event_hub_destination.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_event_hub_destination.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
@@ -53,6 +51,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic_EventHubDestination.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_UpdateForCustomTopic_EventHubDestination.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_hybrid_connection_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_hybrid_connection_destination.py
index 61570c47086e..e790f8b5d919 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_hybrid_connection_destination.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_hybrid_connection_destination.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
@@ -53,6 +51,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic_HybridConnectionDestination.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_UpdateForCustomTopic_HybridConnectionDestination.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_service_bus_queue_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_service_bus_queue_destination.py
index f8540f0f4571..d0cf361a3213 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_service_bus_queue_destination.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_service_bus_queue_destination.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
@@ -59,6 +57,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic_ServiceBusQueueDestination.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_UpdateForCustomTopic_ServiceBusQueueDestination.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_service_bus_topic_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_service_bus_topic_destination.py
index 1049d6c6c239..6c526a5128ca 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_service_bus_topic_destination.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_service_bus_topic_destination.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
@@ -53,6 +51,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic_ServiceBusTopicDestination.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_UpdateForCustomTopic_ServiceBusTopicDestination.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_storage_queue_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_storage_queue_destination.py
index 122036ce1770..d7aaf9092af2 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_storage_queue_destination.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_storage_queue_destination.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
@@ -61,6 +59,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic_StorageQueueDestination.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_UpdateForCustomTopic_StorageQueueDestination.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_webhook_destination.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_webhook_destination.py
index 7eb9ed1f0186..9f7e9a02bf39 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_webhook_destination.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_custom_topic_webhook_destination.py
@@ -6,8 +6,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
@@ -48,6 +46,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForCustomTopic_WebhookDestination.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_UpdateForCustomTopic_WebhookDestination.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_resource.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_resource.py
index 8e5ed94ad0d4..21c11fc7fa29 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_resource.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_resource.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.eventgrid import EventGridManagementClient
@@ -48,6 +46,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForResource.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_UpdateForResource.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_resource_group.py
index 1fe1bd0f29f8..09b8b1fe5a6d 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_resource_group.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_resource_group.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.eventgrid import EventGridManagementClient
@@ -53,6 +51,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForResourceGroup.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_UpdateForResourceGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_subscription.py
index f8291ac003d4..363241f12bfa 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_subscription.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/event_subscriptions_update_for_subscription.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.eventgrid import EventGridManagementClient
@@ -48,6 +46,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/EventSubscriptions_UpdateForSubscription.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/EventSubscriptions_UpdateForSubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/extension_topics_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/extension_topics_get.py
index 3af6efdf5109..fb9421c4c481 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/extension_topics_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/extension_topics_get.py
@@ -36,6 +36,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/ExtensionTopics_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/ExtensionTopics_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_create_or_update.py
index 1f91a47cdb4c..4a4ae19fa019 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_create_or_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.eventgrid import EventGridManagementClient
@@ -50,6 +48,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopicEventSubscriptions_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/NamespaceTopicEventSubscriptions_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_delete.py
index c8028f06e430..5a9b298a2177 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_delete.py
@@ -38,6 +38,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopicEventSubscriptions_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/NamespaceTopicEventSubscriptions_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get.py
index bdc488991d18..a5d165fc2541 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get.py
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopicEventSubscriptions_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/NamespaceTopicEventSubscriptions_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get_delivery_attributes.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get_delivery_attributes.py
index d985649e15a6..11db5cee4cf8 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get_delivery_attributes.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get_delivery_attributes.py
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopicEventSubscriptions_GetDeliveryAttributes.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/NamespaceTopicEventSubscriptions_GetDeliveryAttributes.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get_full_url.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get_full_url.py
index ab8584c15c42..5dc2700006ae 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get_full_url.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_get_full_url.py
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopicEventSubscriptions_GetFullUrl.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/NamespaceTopicEventSubscriptions_GetFullUrl.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_list_by_namespace_topic.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_list_by_namespace_topic.py
index 3d4f0e4546a3..caa51dc356f8 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_list_by_namespace_topic.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_list_by_namespace_topic.py
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopicEventSubscriptions_ListByNamespaceTopic.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/NamespaceTopicEventSubscriptions_ListByNamespaceTopic.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_update.py
index 4d656d4630ad..965bc55f8240 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topic_event_subscriptions_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.eventgrid import EventGridManagementClient
@@ -50,6 +48,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopicEventSubscriptions_Update.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/NamespaceTopicEventSubscriptions_Update.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_create_or_update.py
index 0c2ed8346283..8b7bc1428eb1 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_create_or_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.eventgrid import EventGridManagementClient
@@ -43,6 +41,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopics_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/NamespaceTopics_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_delete.py
index 8c498b58dfb1..a46eea3cac93 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_delete.py
@@ -37,6 +37,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopics_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/NamespaceTopics_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_get.py
index 3f041444c702..ce597f63bd40 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_get.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopics_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/NamespaceTopics_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_list_by_namespace.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_list_by_namespace.py
index 08cae210b16e..491bb6a26cde 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_list_by_namespace.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_list_by_namespace.py
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopics_ListByNamespace.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/NamespaceTopics_ListByNamespace.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_list_shared_access_keys.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_list_shared_access_keys.py
index df897a5d76b3..faa908fe54c9 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_list_shared_access_keys.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_list_shared_access_keys.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopics_ListSharedAccessKeys.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/NamespaceTopics_ListSharedAccessKeys.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_regenerate_key.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_regenerate_key.py
index 469c7b92f15d..678f5af0fcee 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_regenerate_key.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_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.eventgrid import EventGridManagementClient
@@ -41,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopics_RegenerateKey.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/NamespaceTopics_RegenerateKey.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_update.py
index 602a9827b8b7..d1658cd97155 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespace_topics_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.eventgrid import EventGridManagementClient
@@ -41,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NamespaceTopics_Update.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/NamespaceTopics_Update.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_create_or_update.py
index b1c809d9229c..2ea11f3afce6 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_create_or_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.eventgrid import EventGridManagementClient
@@ -49,6 +47,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Namespaces_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Namespaces_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_delete.py
index 6f1d32f88b76..f52beb046d8e 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_delete.py
@@ -36,6 +36,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Namespaces_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Namespaces_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_get.py
index 27cad8b8e1ee..130195e6b79b 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_get.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Namespaces_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Namespaces_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_by_resource_group.py
index ed64c11a9bd0..6c972e0ea5fd 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_by_resource_group.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_by_resource_group.py
@@ -37,6 +37,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Namespaces_ListByResourceGroup.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Namespaces_ListByResourceGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_by_subscription.py
index a07be92ee57a..7cdcc3e2d945 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_by_subscription.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_by_subscription.py
@@ -35,6 +35,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Namespaces_ListBySubscription.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Namespaces_ListBySubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_shared_access_keys.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_shared_access_keys.py
index 1113f529fa06..337f29acf454 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_shared_access_keys.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_list_shared_access_keys.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Namespaces_ListSharedAccessKeys.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Namespaces_ListSharedAccessKeys.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_regenerate_key.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_regenerate_key.py
index 434599fa18ef..fc4d4a3b36aa 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_regenerate_key.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_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.eventgrid import EventGridManagementClient
@@ -40,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Namespaces_RegenerateKey.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Namespaces_RegenerateKey.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_update.py
index 48a78369eb4f..59770944a4fc 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_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.eventgrid import EventGridManagementClient
@@ -40,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Namespaces_Update.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Namespaces_Update.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_validate_custom_domain_ownership.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_validate_custom_domain_ownership.py
index 3c924649551f..525ba59593f1 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_validate_custom_domain_ownership.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/namespaces_validate_custom_domain_ownership.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Namespaces_ValidateCustomDomainOwnership.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Namespaces_ValidateCustomDomainOwnership.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_get.py
index e57480d50f33..4c2bcbb40602 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_get.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -45,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NetworkSecurityPerimeterConfigurations_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/NetworkSecurityPerimeterConfigurations_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_list.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_list.py
index 201d1ccdfd96..7a1c3420f87c 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_list.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_list.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -44,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NetworkSecurityPerimeterConfigurations_List.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/NetworkSecurityPerimeterConfigurations_List.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_reconcile.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_reconcile.py
index 3588fa58adec..ad29db881fe6 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_reconcile.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/network_security_perimeter_configurations_reconcile.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -45,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/NetworkSecurityPerimeterConfigurations_Reconcile.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/NetworkSecurityPerimeterConfigurations_Reconcile.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/operations_list.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/operations_list.py
index d9d4fb92ab38..7fdfaeeac8fb 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/operations_list.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/operations_list.py
@@ -35,6 +35,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Operations_List.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Operations_List.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_authorize_partner.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_authorize_partner.py
index ae8dc8224ee0..2d034dcea445 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_authorize_partner.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_authorize_partner.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.eventgrid import EventGridManagementClient
@@ -43,6 +41,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerConfigurations_AuthorizePartner.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerConfigurations_AuthorizePartner.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_create_or_update.py
index 6d6f11c8aaa6..2fa23e7eeeef 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_create_or_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.eventgrid import EventGridManagementClient
@@ -57,6 +55,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerConfigurations_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerConfigurations_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_delete.py
index 49e4a8d7e0c5..e88e73c0e329 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_delete.py
@@ -35,6 +35,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerConfigurations_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerConfigurations_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_get.py
index bff1100db47f..2626d8f39a23 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_get.py
@@ -36,6 +36,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerConfigurations_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerConfigurations_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_list_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_list_by_resource_group.py
index 867614fab19d..df48532b901e 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_list_by_resource_group.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_list_by_resource_group.py
@@ -37,6 +37,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerConfigurations_ListByResourceGroup.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerConfigurations_ListByResourceGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_list_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_list_by_subscription.py
index c91be01db1af..3ac6f0450afe 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_list_by_subscription.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_list_by_subscription.py
@@ -35,6 +35,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerConfigurations_ListBySubscription.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerConfigurations_ListBySubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_unauthorize_partner.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_unauthorize_partner.py
index 7bb1ee07a640..924778922e7b 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_unauthorize_partner.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_unauthorize_partner.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.eventgrid import EventGridManagementClient
@@ -43,6 +41,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerConfigurations_UnauthorizePartner.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerConfigurations_UnauthorizePartner.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_update.py
index 5e6fb4b44ab5..046e4e892eca 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_configurations_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.eventgrid import EventGridManagementClient
@@ -42,6 +40,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerConfigurations_Update.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerConfigurations_Update.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_activate.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_activate.py
index 99234c2c2e2b..223dc1475af7 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_activate.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_activate.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerDestinations_Activate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerDestinations_Activate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_create_or_update.py
index 352e13d6df33..12ce9a64c875 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_create_or_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.eventgrid import EventGridManagementClient
@@ -49,6 +47,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerDestinations_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerDestinations_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_delete.py
index fac47c42a17e..742acd016090 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_delete.py
@@ -36,6 +36,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerDestinations_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerDestinations_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_get.py
index 038c5879cc8b..2a74f4025ded 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_get.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerDestinations_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerDestinations_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_list_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_list_by_resource_group.py
index 0283e27f5ed7..96c1108c8bdd 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_list_by_resource_group.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_list_by_resource_group.py
@@ -37,6 +37,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerDestinations_ListByResourceGroup.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerDestinations_ListByResourceGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_list_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_list_by_subscription.py
index 618d8ad1f8e9..1796ddbd667b 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_list_by_subscription.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_list_by_subscription.py
@@ -35,6 +35,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerDestinations_ListBySubscription.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerDestinations_ListBySubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_update.py
index 9f9bc291fcd5..c6fd9e91cee1 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_destinations_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.eventgrid import EventGridManagementClient
@@ -40,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerDestinations_Update.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerDestinations_Update.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_create_or_update.py
index ff8a2db3f235..e32a7579d2b1 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_create_or_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.eventgrid import EventGridManagementClient
@@ -46,6 +44,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerNamespaces_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerNamespaces_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_delete.py
index 50b44d588eb6..71a4da49e4d3 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_delete.py
@@ -36,6 +36,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerNamespaces_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerNamespaces_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_get.py
index 054186657a59..05330a60afc5 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_get.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerNamespaces_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerNamespaces_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_by_resource_group.py
index 9d00c00ad818..edb2dc0ef486 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_by_resource_group.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_by_resource_group.py
@@ -37,6 +37,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerNamespaces_ListByResourceGroup.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerNamespaces_ListByResourceGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_by_subscription.py
index b02cec14e7e4..69300620f862 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_by_subscription.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_by_subscription.py
@@ -35,6 +35,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerNamespaces_ListBySubscription.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerNamespaces_ListBySubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_shared_access_keys.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_shared_access_keys.py
index 2f762a414f75..c2cc31743155 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_shared_access_keys.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_list_shared_access_keys.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerNamespaces_ListSharedAccessKeys.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerNamespaces_ListSharedAccessKeys.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_regenerate_key.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_regenerate_key.py
index 695721d91de8..0847eeae15f0 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_regenerate_key.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_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.eventgrid import EventGridManagementClient
@@ -40,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerNamespaces_RegenerateKey.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerNamespaces_RegenerateKey.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_update.py
index 7df4f30151d5..13a99ace0ad1 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_namespaces_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.eventgrid import EventGridManagementClient
@@ -40,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerNamespaces_Update.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerNamespaces_Update.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_create_or_update.py
index 86ea0d5608d9..bc47d5e66e66 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_create_or_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.eventgrid import EventGridManagementClient
@@ -43,6 +41,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerRegistrations_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerRegistrations_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_delete.py
index 75e6c2097bcb..32217af2d864 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_delete.py
@@ -36,6 +36,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerRegistrations_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerRegistrations_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_get.py
index a848fb41cb76..e6abde45acc9 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_get.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerRegistrations_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerRegistrations_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_list_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_list_by_resource_group.py
index ee03518a1777..c4146b070ccb 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_list_by_resource_group.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_list_by_resource_group.py
@@ -37,6 +37,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerRegistrations_ListByResourceGroup.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerRegistrations_ListByResourceGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_list_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_list_by_subscription.py
index c56890cd24c7..1e3d5a36d135 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_list_by_subscription.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_list_by_subscription.py
@@ -35,6 +35,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerRegistrations_ListBySubscription.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerRegistrations_ListBySubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_update.py
index efc68c3ee425..f05f0fd284ef 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_registrations_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.eventgrid import EventGridManagementClient
@@ -40,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerRegistrations_Update.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerRegistrations_Update.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_create_or_update.py
index b658645df99a..4fe015526e2e 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_create_or_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.eventgrid import EventGridManagementClient
@@ -53,6 +51,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopicEventSubscriptions_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerTopicEventSubscriptions_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_delete.py
index 998c713188e1..bd8f611e6ace 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_delete.py
@@ -37,6 +37,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopicEventSubscriptions_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerTopicEventSubscriptions_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get.py
index 1ea75dd129a1..6b8ecf68b9ae 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopicEventSubscriptions_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerTopicEventSubscriptions_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get_delivery_attributes.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get_delivery_attributes.py
index fb3c09398e35..3a98fced94ea 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get_delivery_attributes.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get_delivery_attributes.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopicEventSubscriptions_GetDeliveryAttributes.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerTopicEventSubscriptions_GetDeliveryAttributes.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get_full_url.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get_full_url.py
index 3be1fc6ca985..d07160872d6e 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get_full_url.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_get_full_url.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopicEventSubscriptions_GetFullUrl.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerTopicEventSubscriptions_GetFullUrl.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_list_by_partner_topic.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_list_by_partner_topic.py
index 006b9bfe47a5..179a697b533e 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_list_by_partner_topic.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_list_by_partner_topic.py
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopicEventSubscriptions_ListByPartnerTopic.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerTopicEventSubscriptions_ListByPartnerTopic.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_update.py
index 13d943828b19..ec0ea6d735d2 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topic_event_subscriptions_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.eventgrid import EventGridManagementClient
@@ -49,6 +47,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopicEventSubscriptions_Update.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerTopicEventSubscriptions_Update.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_activate.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_activate.py
index afcfbe291a91..92dd653b9427 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_activate.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_activate.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopics_Activate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerTopics_Activate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_create_or_update.py
index 027ae7d706e8..a3624c4d553b 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_create_or_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.eventgrid import EventGridManagementClient
@@ -49,6 +47,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopics_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerTopics_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_deactivate.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_deactivate.py
index 5df6f53495ca..942ccfceaf0e 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_deactivate.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_deactivate.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopics_Deactivate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerTopics_Deactivate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_delete.py
index ff72e86f4a6e..f519246b069a 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_delete.py
@@ -36,6 +36,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopics_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerTopics_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_get.py
index 7f66fdd17c0c..2c5b9c9e7935 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_get.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopics_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerTopics_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_list_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_list_by_resource_group.py
index 35d5d1ac6cce..1adae5a3e5cd 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_list_by_resource_group.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_list_by_resource_group.py
@@ -37,6 +37,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopics_ListByResourceGroup.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerTopics_ListByResourceGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_list_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_list_by_subscription.py
index 0a389ca1daf3..b48d6878ccb2 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_list_by_subscription.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_list_by_subscription.py
@@ -35,6 +35,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopics_ListBySubscription.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerTopics_ListBySubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_update.py
index 7d2e70a01034..7e312c97e95a 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/partner_topics_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.eventgrid import EventGridManagementClient
@@ -40,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PartnerTopics_Update.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PartnerTopics_Update.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_create_or_update.py
index 81b1e21ce88a..57a6be46ca9f 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_create_or_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.eventgrid import EventGridManagementClient
@@ -47,6 +45,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PermissionBindings_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PermissionBindings_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_delete.py
index 308bd6c3f665..54321a15c6bc 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_delete.py
@@ -37,6 +37,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PermissionBindings_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PermissionBindings_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_get.py
index dec90fac3f4b..2832adf4bbb1 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_get.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PermissionBindings_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PermissionBindings_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_list_by_namespace.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_list_by_namespace.py
index e9189eef41cc..22bb59c13438 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_list_by_namespace.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/permission_bindings_list_by_namespace.py
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PermissionBindings_ListByNamespace.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PermissionBindings_ListByNamespace.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_delete.py
index fe19264fefdc..81c55426d360 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_delete.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -43,6 +38,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PrivateEndpointConnections_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PrivateEndpointConnections_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_get.py
index dda03916c088..606b58bbeab6 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_get.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -44,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PrivateEndpointConnections_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PrivateEndpointConnections_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_list_by_resource.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_list_by_resource.py
index e5dd25a7f9e0..b41c441526f4 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_list_by_resource.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_list_by_resource.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -44,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PrivateEndpointConnections_ListByResource.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PrivateEndpointConnections_ListByResource.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_update.py
index 27c7d31732c4..442e15d7bf3d 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_endpoint_connections_update.py
@@ -6,15 +6,10 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
-from typing import Any, IO, TYPE_CHECKING, Union
-
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
-if TYPE_CHECKING:
- # pylint: disable=unused-import,ungrouped-imports
- from .. import models as _models
"""
# PREREQUISITES
pip install azure-identity
@@ -53,6 +48,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PrivateEndpointConnections_Update.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PrivateEndpointConnections_Update.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_link_resources_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_link_resources_get.py
index ff7232f4663b..3ef8b872275f 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_link_resources_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_link_resources_get.py
@@ -39,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PrivateLinkResources_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PrivateLinkResources_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_link_resources_list_by_resource.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_link_resources_list_by_resource.py
index d0b135b18ba2..6004af105266 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_link_resources_list_by_resource.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/private_link_resources_list_by_resource.py
@@ -39,6 +39,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/PrivateLinkResources_ListByResource.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/PrivateLinkResources_ListByResource.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_create_or_update.py
index 9699db8e732a..724764c3b939 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_create_or_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.eventgrid import EventGridManagementClient
@@ -53,6 +51,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopicEventSubscriptions_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/SystemTopicEventSubscriptions_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_delete.py
index 8fa1cd60651c..ef3bdbab74e6 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_delete.py
@@ -37,6 +37,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopicEventSubscriptions_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/SystemTopicEventSubscriptions_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get.py
index 8f940e37ec40..28ccbc3720d6 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopicEventSubscriptions_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/SystemTopicEventSubscriptions_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get_delivery_attributes.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get_delivery_attributes.py
index 0244568dcfbf..9ce8266265cd 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get_delivery_attributes.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get_delivery_attributes.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopicEventSubscriptions_GetDeliveryAttributes.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/SystemTopicEventSubscriptions_GetDeliveryAttributes.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get_full_url.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get_full_url.py
index 3558a998f407..34384a0bf394 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get_full_url.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_get_full_url.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopicEventSubscriptions_GetFullUrl.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/SystemTopicEventSubscriptions_GetFullUrl.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_list_by_system_topic.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_list_by_system_topic.py
index 2f84310646c4..b9fb94d98690 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_list_by_system_topic.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_list_by_system_topic.py
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopicEventSubscriptions_ListBySystemTopic.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/SystemTopicEventSubscriptions_ListBySystemTopic.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_update.py
index 3855955fbbcc..45e82ece34b5 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topic_event_subscriptions_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.eventgrid import EventGridManagementClient
@@ -49,6 +47,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopicEventSubscriptions_Update.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/SystemTopicEventSubscriptions_Update.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_create_or_update.py
index d6390388ba34..de44238c44fb 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_create_or_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.eventgrid import EventGridManagementClient
@@ -47,6 +45,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopics_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/SystemTopics_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_delete.py
index 1c6db356c6cf..4059f4b24c18 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_delete.py
@@ -36,6 +36,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopics_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/SystemTopics_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_get.py
index 01cfc1c3184a..bcef0954672c 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_get.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopics_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/SystemTopics_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_list_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_list_by_resource_group.py
index fd78bdf9b5fd..ee314222b8fc 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_list_by_resource_group.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_list_by_resource_group.py
@@ -37,6 +37,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopics_ListByResourceGroup.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/SystemTopics_ListByResourceGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_list_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_list_by_subscription.py
index d14221a7df36..f108dd8cda0c 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_list_by_subscription.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_list_by_subscription.py
@@ -35,6 +35,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopics_ListBySubscription.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/SystemTopics_ListBySubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_update.py
index 46a52a0af489..86a36478dd56 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/system_topics_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.eventgrid import EventGridManagementClient
@@ -40,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/SystemTopics_Update.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/SystemTopics_Update.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_create_or_update.py
index d001da8ce001..5955153455de 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_create_or_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.eventgrid import EventGridManagementClient
@@ -53,6 +51,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicEventSubscriptions_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/TopicEventSubscriptions_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_delete.py
index ceb856922371..e1082f841791 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_delete.py
@@ -37,6 +37,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicEventSubscriptions_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/TopicEventSubscriptions_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get.py
index a532fb2f820c..acd5973dff69 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicEventSubscriptions_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/TopicEventSubscriptions_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get_delivery_attributes.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get_delivery_attributes.py
index 62c33bafb4fd..e70384c19f6a 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get_delivery_attributes.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get_delivery_attributes.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicEventSubscriptions_GetDeliveryAttributes.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/TopicEventSubscriptions_GetDeliveryAttributes.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get_full_url.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get_full_url.py
index cda769c8e53b..633c49ad9d94 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get_full_url.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_get_full_url.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicEventSubscriptions_GetFullUrl.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/TopicEventSubscriptions_GetFullUrl.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_list.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_list.py
index 0b4222575406..04d79f9537e7 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_list.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_list.py
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicEventSubscriptions_List.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/TopicEventSubscriptions_List.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_update.py
index 60e2238cc81d..cdb1c3fcdd29 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_event_subscriptions_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.eventgrid import EventGridManagementClient
@@ -49,6 +47,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicEventSubscriptions_Update.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/TopicEventSubscriptions_Update.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_create_or_update.py
index 8acebd8bb079..947492a5f437 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_create_or_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.eventgrid import EventGridManagementClient
@@ -41,6 +39,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicSpaces_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/TopicSpaces_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_delete.py
index aa3b709e2538..903c2651c8af 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_delete.py
@@ -37,6 +37,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicSpaces_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/TopicSpaces_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_get.py
index 1334dbf42627..9faa9f3278a3 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_get.py
@@ -38,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicSpaces_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/TopicSpaces_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_list_by_namespace.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_list_by_namespace.py
index 497724ebc337..084c670851a7 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_list_by_namespace.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_spaces_list_by_namespace.py
@@ -38,6 +38,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicSpaces_ListByNamespace.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/TopicSpaces_ListByNamespace.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_get.py
index c2e60a95b888..246954b36d3a 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_get.py
@@ -36,6 +36,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicTypes_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/TopicTypes_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_list.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_list.py
index 01fd0cbf15e1..4c85d10ce44d 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_list.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_list.py
@@ -35,6 +35,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicTypes_List.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/TopicTypes_List.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_list_event_types.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_list_event_types.py
index 8bcfb9334987..7bf932725c3b 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_list_event_types.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topic_types_list_event_types.py
@@ -37,6 +37,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/TopicTypes_ListEventTypes.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/TopicTypes_ListEventTypes.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_create_or_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_create_or_update.py
index cf9135b129f2..291f6f3d9b36 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_create_or_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_create_or_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.eventgrid import EventGridManagementClient
@@ -50,6 +48,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Topics_CreateOrUpdate.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Topics_CreateOrUpdate.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_create_or_update_for_azure_arc.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_create_or_update_for_azure_arc.py
index b0bf04b3cb35..615f1bc9ae88 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_create_or_update_for_azure_arc.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_create_or_update_for_azure_arc.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.eventgrid import EventGridManagementClient
@@ -49,6 +47,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Topics_CreateOrUpdateForAzureArc.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Topics_CreateOrUpdateForAzureArc.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_delete.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_delete.py
index 78a70f8a2562..ec75eef02ecd 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_delete.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_delete.py
@@ -36,6 +36,6 @@ def main():
).result()
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Topics_Delete.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Topics_Delete.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_get.py
index 5ba6abe2555d..49ee6a25a4c4 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_get.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Topics_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Topics_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_by_resource_group.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_by_resource_group.py
index b89fdee5599b..25e0f31a6aaf 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_by_resource_group.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_by_resource_group.py
@@ -37,6 +37,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Topics_ListByResourceGroup.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Topics_ListByResourceGroup.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_by_subscription.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_by_subscription.py
index 02aa675d7c7b..498d2d51c67e 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_by_subscription.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_by_subscription.py
@@ -35,6 +35,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Topics_ListBySubscription.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Topics_ListBySubscription.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_event_types.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_event_types.py
index 07e105fa8963..ddc5ccdeea85 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_event_types.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_event_types.py
@@ -40,6 +40,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Topics_ListEventTypes.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Topics_ListEventTypes.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_shared_access_keys.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_shared_access_keys.py
index 4a58e1681bd9..751ff2f487c0 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_shared_access_keys.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_list_shared_access_keys.py
@@ -37,6 +37,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Topics_ListSharedAccessKeys.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Topics_ListSharedAccessKeys.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_regenerate_key.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_regenerate_key.py
index d6368c4b7290..097d484d44cf 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_regenerate_key.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_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.eventgrid import EventGridManagementClient
@@ -40,6 +38,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Topics_RegenerateKey.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Topics_RegenerateKey.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_update.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_update.py
index b7a2acb00154..11e874edcc98 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_update.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/topics_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.eventgrid import EventGridManagementClient
@@ -49,6 +47,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/Topics_Update.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/Topics_Update.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/verified_partners_get.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/verified_partners_get.py
index d6684c96a87f..b1ddfaac9f41 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/verified_partners_get.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/verified_partners_get.py
@@ -36,6 +36,6 @@ def main():
print(response)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/VerifiedPartners_Get.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/VerifiedPartners_Get.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/verified_partners_list.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/verified_partners_list.py
index 12110010367b..7e1aed9a852f 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/verified_partners_list.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_samples/verified_partners_list.py
@@ -35,6 +35,6 @@ def main():
print(item)
-# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-06-01-preview/examples/VerifiedPartners_List.json
+# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/preview/2024-12-15-preview/examples/VerifiedPartners_List.json
if __name__ == "__main__":
main()
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/conftest.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/conftest.py
new file mode 100644
index 000000000000..b99ede8d9508
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/conftest.py
@@ -0,0 +1,37 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import os
+import pytest
+from dotenv import load_dotenv
+from devtools_testutils import (
+ test_proxy,
+ add_general_regex_sanitizer,
+ add_body_key_sanitizer,
+ add_header_regex_sanitizer,
+)
+
+load_dotenv()
+
+
+# For security, please avoid record sensitive identity information in recordings
+@pytest.fixture(scope="session", autouse=True)
+def add_sanitizers(test_proxy):
+ eventgridmanagement_subscription_id = os.environ.get(
+ "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000"
+ )
+ eventgridmanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000")
+ eventgridmanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
+ eventgridmanagement_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000")
+ add_general_regex_sanitizer(regex=eventgridmanagement_subscription_id, value="00000000-0000-0000-0000-000000000000")
+ add_general_regex_sanitizer(regex=eventgridmanagement_tenant_id, value="00000000-0000-0000-0000-000000000000")
+ add_general_regex_sanitizer(regex=eventgridmanagement_client_id, value="00000000-0000-0000-0000-000000000000")
+ add_general_regex_sanitizer(regex=eventgridmanagement_client_secret, value="00000000-0000-0000-0000-000000000000")
+
+ add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]")
+ add_header_regex_sanitizer(key="Cookie", value="cookie;")
+ add_body_key_sanitizer(json_path="$..access_token", value="access_token")
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_ca_certificates_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_ca_certificates_operations.py
new file mode 100644
index 000000000000..c0b46cb4dfbc
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_ca_certificates_operations.py
@@ -0,0 +1,88 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementCaCertificatesOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_ca_certificates_get(self, resource_group):
+ response = self.client.ca_certificates.get(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ ca_certificate_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_ca_certificates_begin_create_or_update(self, resource_group):
+ response = self.client.ca_certificates.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ ca_certificate_name="str",
+ ca_certificate_info={
+ "description": "str",
+ "encodedCertificate": "str",
+ "expiryTimeInUtc": "2020-02-20 00:00:00",
+ "id": "str",
+ "issueTimeInUtc": "2020-02-20 00:00:00",
+ "name": "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="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_ca_certificates_begin_delete(self, resource_group):
+ response = self.client.ca_certificates.begin_delete(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ ca_certificate_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_ca_certificates_list_by_namespace(self, resource_group):
+ response = self.client.ca_certificates.list_by_namespace(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_ca_certificates_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_ca_certificates_operations_async.py
new file mode 100644
index 000000000000..b375e813f50e
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_ca_certificates_operations_async.py
@@ -0,0 +1,93 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementCaCertificatesOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_ca_certificates_get(self, resource_group):
+ response = await self.client.ca_certificates.get(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ ca_certificate_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_ca_certificates_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.ca_certificates.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ ca_certificate_name="str",
+ ca_certificate_info={
+ "description": "str",
+ "encodedCertificate": "str",
+ "expiryTimeInUtc": "2020-02-20 00:00:00",
+ "id": "str",
+ "issueTimeInUtc": "2020-02-20 00:00:00",
+ "name": "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="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_ca_certificates_begin_delete(self, resource_group):
+ response = await (
+ await self.client.ca_certificates.begin_delete(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ ca_certificate_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_ca_certificates_list_by_namespace(self, resource_group):
+ response = self.client.ca_certificates.list_by_namespace(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_channels_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_channels_operations.py
new file mode 100644
index 000000000000..4ce11675c177
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_channels_operations.py
@@ -0,0 +1,149 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementChannelsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_channels_get(self, resource_group):
+ response = self.client.channels.get(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ channel_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_channels_create_or_update(self, resource_group):
+ response = self.client.channels.create_or_update(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ channel_name="str",
+ channel_info={
+ "channelType": "str",
+ "expirationTimeIfNotActivatedUtc": "2020-02-20 00:00:00",
+ "id": "str",
+ "messageForActivation": "str",
+ "name": "str",
+ "partnerDestinationInfo": "partner_destination_info",
+ "partnerTopicInfo": {
+ "azureSubscriptionId": "str",
+ "eventTypeInfo": {
+ "inlineEventTypes": {
+ "str": {
+ "dataSchemaUrl": "str",
+ "description": "str",
+ "displayName": "str",
+ "documentationUrl": "str",
+ }
+ },
+ "kind": "str",
+ },
+ "name": "str",
+ "resourceGroupName": "str",
+ "source": "str",
+ },
+ "provisioningState": "str",
+ "readinessState": "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-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_channels_begin_delete(self, resource_group):
+ response = self.client.channels.begin_delete(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ channel_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_channels_update(self, resource_group):
+ response = self.client.channels.update(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ channel_name="str",
+ channel_update_parameters={
+ "expirationTimeIfNotActivatedUtc": "2020-02-20 00:00:00",
+ "partnerDestinationInfo": "partner_update_destination_info",
+ "partnerTopicInfo": {
+ "eventTypeInfo": {
+ "inlineEventTypes": {
+ "str": {
+ "dataSchemaUrl": "str",
+ "description": "str",
+ "displayName": "str",
+ "documentationUrl": "str",
+ }
+ },
+ "kind": "str",
+ }
+ },
+ },
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_channels_list_by_partner_namespace(self, resource_group):
+ response = self.client.channels.list_by_partner_namespace(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_channels_get_full_url(self, resource_group):
+ response = self.client.channels.get_full_url(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ channel_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_channels_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_channels_operations_async.py
new file mode 100644
index 000000000000..3da1fecaedf7
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_channels_operations_async.py
@@ -0,0 +1,152 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementChannelsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_channels_get(self, resource_group):
+ response = await self.client.channels.get(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ channel_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_channels_create_or_update(self, resource_group):
+ response = await self.client.channels.create_or_update(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ channel_name="str",
+ channel_info={
+ "channelType": "str",
+ "expirationTimeIfNotActivatedUtc": "2020-02-20 00:00:00",
+ "id": "str",
+ "messageForActivation": "str",
+ "name": "str",
+ "partnerDestinationInfo": "partner_destination_info",
+ "partnerTopicInfo": {
+ "azureSubscriptionId": "str",
+ "eventTypeInfo": {
+ "inlineEventTypes": {
+ "str": {
+ "dataSchemaUrl": "str",
+ "description": "str",
+ "displayName": "str",
+ "documentationUrl": "str",
+ }
+ },
+ "kind": "str",
+ },
+ "name": "str",
+ "resourceGroupName": "str",
+ "source": "str",
+ },
+ "provisioningState": "str",
+ "readinessState": "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-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_channels_begin_delete(self, resource_group):
+ response = await (
+ await self.client.channels.begin_delete(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ channel_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_channels_update(self, resource_group):
+ response = await self.client.channels.update(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ channel_name="str",
+ channel_update_parameters={
+ "expirationTimeIfNotActivatedUtc": "2020-02-20 00:00:00",
+ "partnerDestinationInfo": "partner_update_destination_info",
+ "partnerTopicInfo": {
+ "eventTypeInfo": {
+ "inlineEventTypes": {
+ "str": {
+ "dataSchemaUrl": "str",
+ "description": "str",
+ "displayName": "str",
+ "documentationUrl": "str",
+ }
+ },
+ "kind": "str",
+ }
+ },
+ },
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_channels_list_by_partner_namespace(self, resource_group):
+ response = self.client.channels.list_by_partner_namespace(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+ 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_channels_get_full_url(self, resource_group):
+ response = await self.client.channels.get_full_url(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ channel_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_client_groups_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_client_groups_operations.py
new file mode 100644
index 000000000000..56684a27808a
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_client_groups_operations.py
@@ -0,0 +1,86 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementClientGroupsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_client_groups_get(self, resource_group):
+ response = self.client.client_groups.get(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ client_group_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_client_groups_begin_create_or_update(self, resource_group):
+ response = self.client.client_groups.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ client_group_name="str",
+ client_group_info={
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "query": "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-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_client_groups_begin_delete(self, resource_group):
+ response = self.client.client_groups.begin_delete(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ client_group_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_client_groups_list_by_namespace(self, resource_group):
+ response = self.client.client_groups.list_by_namespace(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_client_groups_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_client_groups_operations_async.py
new file mode 100644
index 000000000000..7b8f2c5cd7c6
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_client_groups_operations_async.py
@@ -0,0 +1,91 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementClientGroupsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_client_groups_get(self, resource_group):
+ response = await self.client.client_groups.get(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ client_group_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_client_groups_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.client_groups.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ client_group_name="str",
+ client_group_info={
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "query": "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-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_client_groups_begin_delete(self, resource_group):
+ response = await (
+ await self.client.client_groups.begin_delete(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ client_group_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_client_groups_list_by_namespace(self, resource_group):
+ response = self.client.client_groups.list_by_namespace(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_clients_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_clients_operations.py
new file mode 100644
index 000000000000..cb6a08bb3ff5
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_clients_operations.py
@@ -0,0 +1,89 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementClientsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_clients_get(self, resource_group):
+ response = self.client.clients.get(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ client_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_clients_begin_create_or_update(self, resource_group):
+ response = self.client.clients.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ client_name="str",
+ client_info={
+ "attributes": {"str": {}},
+ "authenticationName": "str",
+ "clientCertificateAuthentication": {"allowedThumbprints": ["str"], "validationScheme": "str"},
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "state": "Enabled",
+ "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-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_clients_begin_delete(self, resource_group):
+ response = self.client.clients.begin_delete(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ client_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_clients_list_by_namespace(self, resource_group):
+ response = self.client.clients.list_by_namespace(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_clients_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_clients_operations_async.py
new file mode 100644
index 000000000000..008908366528
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_clients_operations_async.py
@@ -0,0 +1,94 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementClientsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_clients_get(self, resource_group):
+ response = await self.client.clients.get(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ client_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_clients_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.clients.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ client_name="str",
+ client_info={
+ "attributes": {"str": {}},
+ "authenticationName": "str",
+ "clientCertificateAuthentication": {"allowedThumbprints": ["str"], "validationScheme": "str"},
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "state": "Enabled",
+ "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-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_clients_begin_delete(self, resource_group):
+ response = await (
+ await self.client.clients.begin_delete(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ client_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_clients_list_by_namespace(self, resource_group):
+ response = self.client.clients.list_by_namespace(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_event_subscriptions_operations.py
new file mode 100644
index 000000000000..f7620e63f2e1
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_event_subscriptions_operations.py
@@ -0,0 +1,186 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementDomainEventSubscriptionsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domain_event_subscriptions_get_delivery_attributes(self, resource_group):
+ response = self.client.domain_event_subscriptions.get_delivery_attributes(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domain_event_subscriptions_get(self, resource_group):
+ response = self.client.domain_event_subscriptions.get(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domain_event_subscriptions_begin_create_or_update(self, resource_group):
+ response = self.client.domain_event_subscriptions.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ event_subscription_name="str",
+ event_subscription_info={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "id": "str",
+ "labels": ["str"],
+ "name": "str",
+ "provisioningState": "str",
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "topic": "str",
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domain_event_subscriptions_begin_delete(self, resource_group):
+ response = self.client.domain_event_subscriptions.begin_delete(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domain_event_subscriptions_begin_update(self, resource_group):
+ response = self.client.domain_event_subscriptions.begin_update(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ event_subscription_name="str",
+ event_subscription_update_parameters={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "labels": ["str"],
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domain_event_subscriptions_get_full_url(self, resource_group):
+ response = self.client.domain_event_subscriptions.get_full_url(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domain_event_subscriptions_list(self, resource_group):
+ response = self.client.domain_event_subscriptions.list(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_event_subscriptions_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_event_subscriptions_operations_async.py
new file mode 100644
index 000000000000..01eeb23442b6
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_event_subscriptions_operations_async.py
@@ -0,0 +1,193 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementDomainEventSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domain_event_subscriptions_get_delivery_attributes(self, resource_group):
+ response = await self.client.domain_event_subscriptions.get_delivery_attributes(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domain_event_subscriptions_get(self, resource_group):
+ response = await self.client.domain_event_subscriptions.get(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domain_event_subscriptions_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.domain_event_subscriptions.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ event_subscription_name="str",
+ event_subscription_info={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "id": "str",
+ "labels": ["str"],
+ "name": "str",
+ "provisioningState": "str",
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "topic": "str",
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domain_event_subscriptions_begin_delete(self, resource_group):
+ response = await (
+ await self.client.domain_event_subscriptions.begin_delete(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domain_event_subscriptions_begin_update(self, resource_group):
+ response = await (
+ await self.client.domain_event_subscriptions.begin_update(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ event_subscription_name="str",
+ event_subscription_update_parameters={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "labels": ["str"],
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domain_event_subscriptions_get_full_url(self, resource_group):
+ response = await self.client.domain_event_subscriptions.get_full_url(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domain_event_subscriptions_list(self, resource_group):
+ response = self.client.domain_event_subscriptions.list(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topic_event_subscriptions_operations.py
new file mode 100644
index 000000000000..0740b3908102
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topic_event_subscriptions_operations.py
@@ -0,0 +1,193 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementDomainTopicEventSubscriptionsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domain_topic_event_subscriptions_get_delivery_attributes(self, resource_group):
+ response = self.client.domain_topic_event_subscriptions.get_delivery_attributes(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domain_topic_event_subscriptions_get(self, resource_group):
+ response = self.client.domain_topic_event_subscriptions.get(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domain_topic_event_subscriptions_begin_create_or_update(self, resource_group):
+ response = self.client.domain_topic_event_subscriptions.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ event_subscription_info={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "id": "str",
+ "labels": ["str"],
+ "name": "str",
+ "provisioningState": "str",
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "topic": "str",
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domain_topic_event_subscriptions_begin_delete(self, resource_group):
+ response = self.client.domain_topic_event_subscriptions.begin_delete(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domain_topic_event_subscriptions_begin_update(self, resource_group):
+ response = self.client.domain_topic_event_subscriptions.begin_update(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ event_subscription_update_parameters={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "labels": ["str"],
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domain_topic_event_subscriptions_get_full_url(self, resource_group):
+ response = self.client.domain_topic_event_subscriptions.get_full_url(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domain_topic_event_subscriptions_list(self, resource_group):
+ response = self.client.domain_topic_event_subscriptions.list(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topic_event_subscriptions_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topic_event_subscriptions_operations_async.py
new file mode 100644
index 000000000000..7f29d427ce73
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topic_event_subscriptions_operations_async.py
@@ -0,0 +1,200 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementDomainTopicEventSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domain_topic_event_subscriptions_get_delivery_attributes(self, resource_group):
+ response = await self.client.domain_topic_event_subscriptions.get_delivery_attributes(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domain_topic_event_subscriptions_get(self, resource_group):
+ response = await self.client.domain_topic_event_subscriptions.get(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domain_topic_event_subscriptions_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.domain_topic_event_subscriptions.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ event_subscription_info={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "id": "str",
+ "labels": ["str"],
+ "name": "str",
+ "provisioningState": "str",
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "topic": "str",
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domain_topic_event_subscriptions_begin_delete(self, resource_group):
+ response = await (
+ await self.client.domain_topic_event_subscriptions.begin_delete(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domain_topic_event_subscriptions_begin_update(self, resource_group):
+ response = await (
+ await self.client.domain_topic_event_subscriptions.begin_update(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ event_subscription_update_parameters={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "labels": ["str"],
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domain_topic_event_subscriptions_get_full_url(self, resource_group):
+ response = await self.client.domain_topic_event_subscriptions.get_full_url(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domain_topic_event_subscriptions_list(self, resource_group):
+ response = self.client.domain_topic_event_subscriptions.list(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topics_operations.py
new file mode 100644
index 000000000000..d40ebae0b460
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topics_operations.py
@@ -0,0 +1,70 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementDomainTopicsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domain_topics_get(self, resource_group):
+ response = self.client.domain_topics.get(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ domain_topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domain_topics_begin_create_or_update(self, resource_group):
+ response = self.client.domain_topics.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ domain_topic_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domain_topics_begin_delete(self, resource_group):
+ response = self.client.domain_topics.begin_delete(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ domain_topic_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domain_topics_list_by_domain(self, resource_group):
+ response = self.client.domain_topics.list_by_domain(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topics_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topics_operations_async.py
new file mode 100644
index 000000000000..a4a44119f424
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domain_topics_operations_async.py
@@ -0,0 +1,75 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementDomainTopicsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domain_topics_get(self, resource_group):
+ response = await self.client.domain_topics.get(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ domain_topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domain_topics_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.domain_topics.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ domain_topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domain_topics_begin_delete(self, resource_group):
+ response = await (
+ await self.client.domain_topics.begin_delete(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ domain_topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domain_topics_list_by_domain(self, resource_group):
+ response = self.client.domain_topics.list_by_domain(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domains_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domains_operations.py
new file mode 100644
index 000000000000..6e9f6367d737
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domains_operations.py
@@ -0,0 +1,201 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementDomainsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domains_get(self, resource_group):
+ response = self.client.domains.get(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domains_begin_create_or_update(self, resource_group):
+ response = self.client.domains.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ domain_info={
+ "location": "str",
+ "autoCreateTopicWithFirstSubscription": True,
+ "autoDeleteTopicWithLastSubscription": True,
+ "dataResidencyBoundary": "str",
+ "disableLocalAuth": False,
+ "endpoint": "str",
+ "eventTypeInfo": {
+ "inlineEventTypes": {
+ "str": {
+ "dataSchemaUrl": "str",
+ "description": "str",
+ "displayName": "str",
+ "documentationUrl": "str",
+ }
+ },
+ "kind": "str",
+ },
+ "id": "str",
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "inboundIpRules": [{"action": "str", "ipMask": "str"}],
+ "inputSchema": "str",
+ "inputSchemaMapping": "input_schema_mapping",
+ "metricResourceId": "str",
+ "minimumTlsVersionAllowed": "str",
+ "name": "str",
+ "privateEndpointConnections": [
+ {
+ "groupIds": ["str"],
+ "id": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {
+ "actionsRequired": "str",
+ "description": "str",
+ "status": "str",
+ },
+ "provisioningState": "str",
+ "type": "str",
+ }
+ ],
+ "provisioningState": "str",
+ "publicNetworkAccess": "str",
+ "sku": {"name": "Basic"},
+ "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",
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domains_begin_delete(self, resource_group):
+ response = self.client.domains.begin_delete(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domains_begin_update(self, resource_group):
+ response = self.client.domains.begin_update(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ domain_update_parameters={
+ "autoCreateTopicWithFirstSubscription": bool,
+ "autoDeleteTopicWithLastSubscription": bool,
+ "dataResidencyBoundary": "str",
+ "disableLocalAuth": bool,
+ "eventTypeInfo": {
+ "inlineEventTypes": {
+ "str": {
+ "dataSchemaUrl": "str",
+ "description": "str",
+ "displayName": "str",
+ "documentationUrl": "str",
+ }
+ },
+ "kind": "str",
+ },
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "inboundIpRules": [{"action": "str", "ipMask": "str"}],
+ "minimumTlsVersionAllowed": "str",
+ "publicNetworkAccess": "str",
+ "sku": {"name": "Basic"},
+ "tags": {"str": "str"},
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domains_list_by_subscription(self, resource_group):
+ response = self.client.domains.list_by_subscription(
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domains_list_by_resource_group(self, resource_group):
+ response = self.client.domains.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domains_list_shared_access_keys(self, resource_group):
+ response = self.client.domains.list_shared_access_keys(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_domains_regenerate_key(self, resource_group):
+ response = self.client.domains.regenerate_key(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ regenerate_key_request={"keyName": "str"},
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domains_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domains_operations_async.py
new file mode 100644
index 000000000000..80f12b435ff4
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_domains_operations_async.py
@@ -0,0 +1,208 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementDomainsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domains_get(self, resource_group):
+ response = await self.client.domains.get(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domains_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.domains.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ domain_info={
+ "location": "str",
+ "autoCreateTopicWithFirstSubscription": True,
+ "autoDeleteTopicWithLastSubscription": True,
+ "dataResidencyBoundary": "str",
+ "disableLocalAuth": False,
+ "endpoint": "str",
+ "eventTypeInfo": {
+ "inlineEventTypes": {
+ "str": {
+ "dataSchemaUrl": "str",
+ "description": "str",
+ "displayName": "str",
+ "documentationUrl": "str",
+ }
+ },
+ "kind": "str",
+ },
+ "id": "str",
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "inboundIpRules": [{"action": "str", "ipMask": "str"}],
+ "inputSchema": "str",
+ "inputSchemaMapping": "input_schema_mapping",
+ "metricResourceId": "str",
+ "minimumTlsVersionAllowed": "str",
+ "name": "str",
+ "privateEndpointConnections": [
+ {
+ "groupIds": ["str"],
+ "id": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {
+ "actionsRequired": "str",
+ "description": "str",
+ "status": "str",
+ },
+ "provisioningState": "str",
+ "type": "str",
+ }
+ ],
+ "provisioningState": "str",
+ "publicNetworkAccess": "str",
+ "sku": {"name": "Basic"},
+ "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",
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domains_begin_delete(self, resource_group):
+ response = await (
+ await self.client.domains.begin_delete(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domains_begin_update(self, resource_group):
+ response = await (
+ await self.client.domains.begin_update(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ domain_update_parameters={
+ "autoCreateTopicWithFirstSubscription": bool,
+ "autoDeleteTopicWithLastSubscription": bool,
+ "dataResidencyBoundary": "str",
+ "disableLocalAuth": bool,
+ "eventTypeInfo": {
+ "inlineEventTypes": {
+ "str": {
+ "dataSchemaUrl": "str",
+ "description": "str",
+ "displayName": "str",
+ "documentationUrl": "str",
+ }
+ },
+ "kind": "str",
+ },
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "inboundIpRules": [{"action": "str", "ipMask": "str"}],
+ "minimumTlsVersionAllowed": "str",
+ "publicNetworkAccess": "str",
+ "sku": {"name": "Basic"},
+ "tags": {"str": "str"},
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domains_list_by_subscription(self, resource_group):
+ response = self.client.domains.list_by_subscription(
+ api_version="2024-12-15-preview",
+ )
+ 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_domains_list_by_resource_group(self, resource_group):
+ response = self.client.domains.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+ 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_domains_list_shared_access_keys(self, resource_group):
+ response = await self.client.domains.list_shared_access_keys(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_domains_regenerate_key(self, resource_group):
+ response = await self.client.domains.regenerate_key(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ regenerate_key_request={"keyName": "str"},
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_event_subscriptions_operations.py
new file mode 100644
index 000000000000..7dbe5705feaa
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_event_subscriptions_operations.py
@@ -0,0 +1,287 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementEventSubscriptionsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_event_subscriptions_get_delivery_attributes(self, resource_group):
+ response = self.client.event_subscriptions.get_delivery_attributes(
+ scope="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_event_subscriptions_get(self, resource_group):
+ response = self.client.event_subscriptions.get(
+ scope="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_event_subscriptions_begin_create_or_update(self, resource_group):
+ response = self.client.event_subscriptions.begin_create_or_update(
+ scope="str",
+ event_subscription_name="str",
+ event_subscription_info={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "id": "str",
+ "labels": ["str"],
+ "name": "str",
+ "provisioningState": "str",
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "topic": "str",
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_event_subscriptions_begin_delete(self, resource_group):
+ response = self.client.event_subscriptions.begin_delete(
+ scope="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_event_subscriptions_begin_update(self, resource_group):
+ response = self.client.event_subscriptions.begin_update(
+ scope="str",
+ event_subscription_name="str",
+ event_subscription_update_parameters={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "labels": ["str"],
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_event_subscriptions_get_full_url(self, resource_group):
+ response = self.client.event_subscriptions.get_full_url(
+ scope="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_event_subscriptions_list_global_by_subscription(self, resource_group):
+ response = self.client.event_subscriptions.list_global_by_subscription(
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_event_subscriptions_list_global_by_subscription_for_topic_type(self, resource_group):
+ response = self.client.event_subscriptions.list_global_by_subscription_for_topic_type(
+ topic_type_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_event_subscriptions_list_global_by_resource_group(self, resource_group):
+ response = self.client.event_subscriptions.list_global_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_event_subscriptions_list_global_by_resource_group_for_topic_type(self, resource_group):
+ response = self.client.event_subscriptions.list_global_by_resource_group_for_topic_type(
+ resource_group_name=resource_group.name,
+ topic_type_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_event_subscriptions_list_regional_by_subscription(self, resource_group):
+ response = self.client.event_subscriptions.list_regional_by_subscription(
+ location="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_event_subscriptions_list_regional_by_resource_group(self, resource_group):
+ response = self.client.event_subscriptions.list_regional_by_resource_group(
+ resource_group_name=resource_group.name,
+ location="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_event_subscriptions_list_regional_by_subscription_for_topic_type(self, resource_group):
+ response = self.client.event_subscriptions.list_regional_by_subscription_for_topic_type(
+ location="str",
+ topic_type_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_event_subscriptions_list_regional_by_resource_group_for_topic_type(self, resource_group):
+ response = self.client.event_subscriptions.list_regional_by_resource_group_for_topic_type(
+ resource_group_name=resource_group.name,
+ location="str",
+ topic_type_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_event_subscriptions_list_by_resource(self, resource_group):
+ response = self.client.event_subscriptions.list_by_resource(
+ resource_group_name=resource_group.name,
+ provider_namespace="str",
+ resource_type_name="str",
+ resource_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_event_subscriptions_list_by_domain_topic(self, resource_group):
+ response = self.client.event_subscriptions.list_by_domain_topic(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_event_subscriptions_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_event_subscriptions_operations_async.py
new file mode 100644
index 000000000000..96820f17e928
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_event_subscriptions_operations_async.py
@@ -0,0 +1,294 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementEventSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_event_subscriptions_get_delivery_attributes(self, resource_group):
+ response = await self.client.event_subscriptions.get_delivery_attributes(
+ scope="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_event_subscriptions_get(self, resource_group):
+ response = await self.client.event_subscriptions.get(
+ scope="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_event_subscriptions_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.event_subscriptions.begin_create_or_update(
+ scope="str",
+ event_subscription_name="str",
+ event_subscription_info={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "id": "str",
+ "labels": ["str"],
+ "name": "str",
+ "provisioningState": "str",
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "topic": "str",
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_event_subscriptions_begin_delete(self, resource_group):
+ response = await (
+ await self.client.event_subscriptions.begin_delete(
+ scope="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_event_subscriptions_begin_update(self, resource_group):
+ response = await (
+ await self.client.event_subscriptions.begin_update(
+ scope="str",
+ event_subscription_name="str",
+ event_subscription_update_parameters={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "labels": ["str"],
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_event_subscriptions_get_full_url(self, resource_group):
+ response = await self.client.event_subscriptions.get_full_url(
+ scope="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_event_subscriptions_list_global_by_subscription(self, resource_group):
+ response = self.client.event_subscriptions.list_global_by_subscription(
+ api_version="2024-12-15-preview",
+ )
+ 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_event_subscriptions_list_global_by_subscription_for_topic_type(self, resource_group):
+ response = self.client.event_subscriptions.list_global_by_subscription_for_topic_type(
+ topic_type_name="str",
+ api_version="2024-12-15-preview",
+ )
+ 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_event_subscriptions_list_global_by_resource_group(self, resource_group):
+ response = self.client.event_subscriptions.list_global_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+ 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_event_subscriptions_list_global_by_resource_group_for_topic_type(self, resource_group):
+ response = self.client.event_subscriptions.list_global_by_resource_group_for_topic_type(
+ resource_group_name=resource_group.name,
+ topic_type_name="str",
+ api_version="2024-12-15-preview",
+ )
+ 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_event_subscriptions_list_regional_by_subscription(self, resource_group):
+ response = self.client.event_subscriptions.list_regional_by_subscription(
+ location="str",
+ api_version="2024-12-15-preview",
+ )
+ 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_event_subscriptions_list_regional_by_resource_group(self, resource_group):
+ response = self.client.event_subscriptions.list_regional_by_resource_group(
+ resource_group_name=resource_group.name,
+ location="str",
+ api_version="2024-12-15-preview",
+ )
+ 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_event_subscriptions_list_regional_by_subscription_for_topic_type(self, resource_group):
+ response = self.client.event_subscriptions.list_regional_by_subscription_for_topic_type(
+ location="str",
+ topic_type_name="str",
+ api_version="2024-12-15-preview",
+ )
+ 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_event_subscriptions_list_regional_by_resource_group_for_topic_type(self, resource_group):
+ response = self.client.event_subscriptions.list_regional_by_resource_group_for_topic_type(
+ resource_group_name=resource_group.name,
+ location="str",
+ topic_type_name="str",
+ api_version="2024-12-15-preview",
+ )
+ 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_event_subscriptions_list_by_resource(self, resource_group):
+ response = self.client.event_subscriptions.list_by_resource(
+ resource_group_name=resource_group.name,
+ provider_namespace="str",
+ resource_type_name="str",
+ resource_name="str",
+ api_version="2024-12-15-preview",
+ )
+ 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_event_subscriptions_list_by_domain_topic(self, resource_group):
+ response = self.client.event_subscriptions.list_by_domain_topic(
+ resource_group_name=resource_group.name,
+ domain_name="str",
+ topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_extension_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_extension_topics_operations.py
new file mode 100644
index 000000000000..208150730ff5
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_extension_topics_operations.py
@@ -0,0 +1,30 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementExtensionTopicsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_extension_topics_get(self, resource_group):
+ response = self.client.extension_topics.get(
+ scope="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_extension_topics_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_extension_topics_operations_async.py
new file mode 100644
index 000000000000..7cd7a3772844
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_extension_topics_operations_async.py
@@ -0,0 +1,31 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementExtensionTopicsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_extension_topics_get(self, resource_group):
+ response = await self.client.extension_topics.get(
+ scope="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topic_event_subscriptions_operations.py
new file mode 100644
index 000000000000..a1988f15aa0e
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topic_event_subscriptions_operations.py
@@ -0,0 +1,214 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementNamespaceTopicEventSubscriptionsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespace_topic_event_subscriptions_get(self, resource_group):
+ response = self.client.namespace_topic_event_subscriptions.get(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespace_topic_event_subscriptions_begin_create_or_update(self, resource_group):
+ response = self.client.namespace_topic_event_subscriptions.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ event_subscription_info={
+ "deliveryConfiguration": {
+ "deliveryMode": "str",
+ "push": {
+ "deadLetterDestinationWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventTimeToLive": "str",
+ "maxDeliveryCount": 0,
+ },
+ "queue": {
+ "deadLetterDestinationWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "eventTimeToLive": "1 day, 0:00:00",
+ "maxDeliveryCount": 0,
+ "receiveLockDurationInSeconds": 0,
+ },
+ },
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filtersConfiguration": {"filters": ["filter"], "includedEventTypes": ["str"]},
+ "id": "str",
+ "name": "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",
+ },
+ "tags": {"str": "str"},
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespace_topic_event_subscriptions_begin_delete(self, resource_group):
+ response = self.client.namespace_topic_event_subscriptions.begin_delete(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespace_topic_event_subscriptions_begin_update(self, resource_group):
+ response = self.client.namespace_topic_event_subscriptions.begin_update(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ event_subscription_update_parameters={
+ "deliveryConfiguration": {
+ "deliveryMode": "str",
+ "push": {
+ "deadLetterDestinationWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventTimeToLive": "str",
+ "maxDeliveryCount": 0,
+ },
+ "queue": {
+ "deadLetterDestinationWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "eventTimeToLive": "1 day, 0:00:00",
+ "maxDeliveryCount": 0,
+ "receiveLockDurationInSeconds": 0,
+ },
+ },
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filtersConfiguration": {"filters": ["filter"], "includedEventTypes": ["str"]},
+ "tags": {"str": "str"},
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespace_topic_event_subscriptions_list_by_namespace_topic(self, resource_group):
+ response = self.client.namespace_topic_event_subscriptions.list_by_namespace_topic(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespace_topic_event_subscriptions_get_delivery_attributes(self, resource_group):
+ response = self.client.namespace_topic_event_subscriptions.get_delivery_attributes(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespace_topic_event_subscriptions_get_full_url(self, resource_group):
+ response = self.client.namespace_topic_event_subscriptions.get_full_url(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topic_event_subscriptions_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topic_event_subscriptions_operations_async.py
new file mode 100644
index 000000000000..0f0c71fe73f6
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topic_event_subscriptions_operations_async.py
@@ -0,0 +1,221 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementNamespaceTopicEventSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_namespace_topic_event_subscriptions_get(self, resource_group):
+ response = await self.client.namespace_topic_event_subscriptions.get(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_namespace_topic_event_subscriptions_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.namespace_topic_event_subscriptions.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ event_subscription_info={
+ "deliveryConfiguration": {
+ "deliveryMode": "str",
+ "push": {
+ "deadLetterDestinationWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventTimeToLive": "str",
+ "maxDeliveryCount": 0,
+ },
+ "queue": {
+ "deadLetterDestinationWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "eventTimeToLive": "1 day, 0:00:00",
+ "maxDeliveryCount": 0,
+ "receiveLockDurationInSeconds": 0,
+ },
+ },
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filtersConfiguration": {"filters": ["filter"], "includedEventTypes": ["str"]},
+ "id": "str",
+ "name": "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",
+ },
+ "tags": {"str": "str"},
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_namespace_topic_event_subscriptions_begin_delete(self, resource_group):
+ response = await (
+ await self.client.namespace_topic_event_subscriptions.begin_delete(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_namespace_topic_event_subscriptions_begin_update(self, resource_group):
+ response = await (
+ await self.client.namespace_topic_event_subscriptions.begin_update(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ event_subscription_update_parameters={
+ "deliveryConfiguration": {
+ "deliveryMode": "str",
+ "push": {
+ "deadLetterDestinationWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventTimeToLive": "str",
+ "maxDeliveryCount": 0,
+ },
+ "queue": {
+ "deadLetterDestinationWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "eventTimeToLive": "1 day, 0:00:00",
+ "maxDeliveryCount": 0,
+ "receiveLockDurationInSeconds": 0,
+ },
+ },
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filtersConfiguration": {"filters": ["filter"], "includedEventTypes": ["str"]},
+ "tags": {"str": "str"},
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_namespace_topic_event_subscriptions_list_by_namespace_topic(self, resource_group):
+ response = self.client.namespace_topic_event_subscriptions.list_by_namespace_topic(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+ 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_namespace_topic_event_subscriptions_get_delivery_attributes(self, resource_group):
+ response = await self.client.namespace_topic_event_subscriptions.get_delivery_attributes(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_namespace_topic_event_subscriptions_get_full_url(self, resource_group):
+ response = await self.client.namespace_topic_event_subscriptions.get_full_url(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topics_operations.py
new file mode 100644
index 000000000000..eae6334812f6
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topics_operations.py
@@ -0,0 +1,128 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementNamespaceTopicsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespace_topics_get(self, resource_group):
+ response = self.client.namespace_topics.get(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespace_topics_begin_create_or_update(self, resource_group):
+ response = self.client.namespace_topics.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ namespace_topic_info={
+ "eventRetentionInDays": 0,
+ "id": "str",
+ "inputSchema": "CloudEventSchemaV1_0",
+ "name": "str",
+ "provisioningState": "str",
+ "publisherType": "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-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespace_topics_begin_delete(self, resource_group):
+ response = self.client.namespace_topics.begin_delete(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespace_topics_begin_update(self, resource_group):
+ response = self.client.namespace_topics.begin_update(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ namespace_topic_update_parameters={"eventRetentionInDays": 0},
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespace_topics_list_by_namespace(self, resource_group):
+ response = self.client.namespace_topics.list_by_namespace(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespace_topics_list_shared_access_keys(self, resource_group):
+ response = self.client.namespace_topics.list_shared_access_keys(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespace_topics_begin_regenerate_key(self, resource_group):
+ response = self.client.namespace_topics.begin_regenerate_key(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ regenerate_key_request={"keyName": "str"},
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topics_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topics_operations_async.py
new file mode 100644
index 000000000000..ee86ae50d18a
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespace_topics_operations_async.py
@@ -0,0 +1,137 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementNamespaceTopicsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_namespace_topics_get(self, resource_group):
+ response = await self.client.namespace_topics.get(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_namespace_topics_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.namespace_topics.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ namespace_topic_info={
+ "eventRetentionInDays": 0,
+ "id": "str",
+ "inputSchema": "CloudEventSchemaV1_0",
+ "name": "str",
+ "provisioningState": "str",
+ "publisherType": "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-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_namespace_topics_begin_delete(self, resource_group):
+ response = await (
+ await self.client.namespace_topics.begin_delete(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_namespace_topics_begin_update(self, resource_group):
+ response = await (
+ await self.client.namespace_topics.begin_update(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ namespace_topic_update_parameters={"eventRetentionInDays": 0},
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_namespace_topics_list_by_namespace(self, resource_group):
+ response = self.client.namespace_topics.list_by_namespace(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+ 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_namespace_topics_list_shared_access_keys(self, resource_group):
+ response = await self.client.namespace_topics.list_shared_access_keys(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_namespace_topics_begin_regenerate_key(self, resource_group):
+ response = await (
+ await self.client.namespace_topics.begin_regenerate_key(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_name="str",
+ regenerate_key_request={"keyName": "str"},
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespaces_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespaces_operations.py
new file mode 100644
index 000000000000..d6231c460525
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespaces_operations.py
@@ -0,0 +1,267 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementNamespacesOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespaces_get(self, resource_group):
+ response = self.client.namespaces.get(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ 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",
+ namespace_info={
+ "location": "str",
+ "id": "str",
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "inboundIpRules": [{"action": "str", "ipMask": "str"}],
+ "isZoneRedundant": bool,
+ "minimumTlsVersionAllowed": "str",
+ "name": "str",
+ "privateEndpointConnections": [
+ {
+ "groupIds": ["str"],
+ "id": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {
+ "actionsRequired": "str",
+ "description": "str",
+ "status": "str",
+ },
+ "provisioningState": "str",
+ "type": "str",
+ }
+ ],
+ "provisioningState": "str",
+ "publicNetworkAccess": "str",
+ "sku": {"capacity": 0, "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",
+ },
+ "tags": {"str": "str"},
+ "topicSpacesConfiguration": {
+ "clientAuthentication": {
+ "alternativeAuthenticationNameSources": ["str"],
+ "customJwtAuthentication": {
+ "encodedIssuerCertificates": [{"encodedCertificate": "str", "kid": "str"}],
+ "issuerCertificates": [
+ {"certificateUrl": "str", "identity": {"type": "str", "userAssignedIdentity": "str"}}
+ ],
+ "tokenIssuer": "str",
+ },
+ },
+ "customDomains": [
+ {
+ "fullyQualifiedDomainName": "str",
+ "certificateUrl": "str",
+ "expectedTxtRecordName": "str",
+ "expectedTxtRecordValue": "str",
+ "identity": {"type": "str", "userAssignedIdentity": "str"},
+ "validationState": "str",
+ }
+ ],
+ "hostname": "str",
+ "maximumClientSessionsPerAuthenticationName": 0,
+ "maximumSessionExpiryInHours": 0,
+ "routeTopicResourceId": "str",
+ "routingEnrichments": {
+ "dynamic": [{"key": "str", "value": "str"}],
+ "static": ["static_routing_enrichment"],
+ },
+ "routingIdentityInfo": {"type": "str", "userAssignedIdentity": "str"},
+ "state": "str",
+ },
+ "topicsConfiguration": {
+ "customDomains": [
+ {
+ "fullyQualifiedDomainName": "str",
+ "certificateUrl": "str",
+ "expectedTxtRecordName": "str",
+ "expectedTxtRecordValue": "str",
+ "identity": {"type": "str", "userAssignedIdentity": "str"},
+ "validationState": "str",
+ }
+ ],
+ "hostname": "str",
+ },
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespaces_begin_delete(self, resource_group):
+ response = self.client.namespaces.begin_delete(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespaces_begin_update(self, resource_group):
+ response = self.client.namespaces.begin_update(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ namespace_update_parameters={
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "inboundIpRules": [{"action": "str", "ipMask": "str"}],
+ "publicNetworkAccess": "str",
+ "sku": {"capacity": 0, "name": "str"},
+ "tags": {"str": "str"},
+ "topicSpacesConfiguration": {
+ "clientAuthentication": {
+ "alternativeAuthenticationNameSources": ["str"],
+ "customJwtAuthentication": {
+ "encodedIssuerCertificates": [{"encodedCertificate": "str", "kid": "str"}],
+ "issuerCertificates": [
+ {"certificateUrl": "str", "identity": {"type": "str", "userAssignedIdentity": "str"}}
+ ],
+ "tokenIssuer": "str",
+ },
+ },
+ "customDomains": [
+ {
+ "fullyQualifiedDomainName": "str",
+ "certificateUrl": "str",
+ "expectedTxtRecordName": "str",
+ "expectedTxtRecordValue": "str",
+ "identity": {"type": "str", "userAssignedIdentity": "str"},
+ "validationState": "str",
+ }
+ ],
+ "maximumClientSessionsPerAuthenticationName": 0,
+ "maximumSessionExpiryInHours": 0,
+ "routeTopicResourceId": "str",
+ "routingEnrichments": {
+ "dynamic": [{"key": "str", "value": "str"}],
+ "static": ["static_routing_enrichment"],
+ },
+ "routingIdentityInfo": {"type": "str", "userAssignedIdentity": "str"},
+ "state": "str",
+ },
+ "topicsConfiguration": {
+ "customDomains": [
+ {
+ "fullyQualifiedDomainName": "str",
+ "certificateUrl": "str",
+ "expectedTxtRecordName": "str",
+ "expectedTxtRecordValue": "str",
+ "identity": {"type": "str", "userAssignedIdentity": "str"},
+ "validationState": "str",
+ }
+ ]
+ },
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespaces_list_by_subscription(self, resource_group):
+ response = self.client.namespaces.list_by_subscription(
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ 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="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespaces_list_shared_access_keys(self, resource_group):
+ response = self.client.namespaces.list_shared_access_keys(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespaces_begin_regenerate_key(self, resource_group):
+ response = self.client.namespaces.begin_regenerate_key(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ regenerate_key_request={"keyName": "str"},
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_namespaces_begin_validate_custom_domain_ownership(self, resource_group):
+ response = self.client.namespaces.begin_validate_custom_domain_ownership(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespaces_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespaces_operations_async.py
new file mode 100644
index 000000000000..1572bc815fbe
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_namespaces_operations_async.py
@@ -0,0 +1,284 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementNamespacesOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ 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="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ 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",
+ namespace_info={
+ "location": "str",
+ "id": "str",
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "inboundIpRules": [{"action": "str", "ipMask": "str"}],
+ "isZoneRedundant": bool,
+ "minimumTlsVersionAllowed": "str",
+ "name": "str",
+ "privateEndpointConnections": [
+ {
+ "groupIds": ["str"],
+ "id": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {
+ "actionsRequired": "str",
+ "description": "str",
+ "status": "str",
+ },
+ "provisioningState": "str",
+ "type": "str",
+ }
+ ],
+ "provisioningState": "str",
+ "publicNetworkAccess": "str",
+ "sku": {"capacity": 0, "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",
+ },
+ "tags": {"str": "str"},
+ "topicSpacesConfiguration": {
+ "clientAuthentication": {
+ "alternativeAuthenticationNameSources": ["str"],
+ "customJwtAuthentication": {
+ "encodedIssuerCertificates": [{"encodedCertificate": "str", "kid": "str"}],
+ "issuerCertificates": [
+ {
+ "certificateUrl": "str",
+ "identity": {"type": "str", "userAssignedIdentity": "str"},
+ }
+ ],
+ "tokenIssuer": "str",
+ },
+ },
+ "customDomains": [
+ {
+ "fullyQualifiedDomainName": "str",
+ "certificateUrl": "str",
+ "expectedTxtRecordName": "str",
+ "expectedTxtRecordValue": "str",
+ "identity": {"type": "str", "userAssignedIdentity": "str"},
+ "validationState": "str",
+ }
+ ],
+ "hostname": "str",
+ "maximumClientSessionsPerAuthenticationName": 0,
+ "maximumSessionExpiryInHours": 0,
+ "routeTopicResourceId": "str",
+ "routingEnrichments": {
+ "dynamic": [{"key": "str", "value": "str"}],
+ "static": ["static_routing_enrichment"],
+ },
+ "routingIdentityInfo": {"type": "str", "userAssignedIdentity": "str"},
+ "state": "str",
+ },
+ "topicsConfiguration": {
+ "customDomains": [
+ {
+ "fullyQualifiedDomainName": "str",
+ "certificateUrl": "str",
+ "expectedTxtRecordName": "str",
+ "expectedTxtRecordValue": "str",
+ "identity": {"type": "str", "userAssignedIdentity": "str"},
+ "validationState": "str",
+ }
+ ],
+ "hostname": "str",
+ },
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_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="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_namespaces_begin_update(self, resource_group):
+ response = await (
+ await self.client.namespaces.begin_update(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ namespace_update_parameters={
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "inboundIpRules": [{"action": "str", "ipMask": "str"}],
+ "publicNetworkAccess": "str",
+ "sku": {"capacity": 0, "name": "str"},
+ "tags": {"str": "str"},
+ "topicSpacesConfiguration": {
+ "clientAuthentication": {
+ "alternativeAuthenticationNameSources": ["str"],
+ "customJwtAuthentication": {
+ "encodedIssuerCertificates": [{"encodedCertificate": "str", "kid": "str"}],
+ "issuerCertificates": [
+ {
+ "certificateUrl": "str",
+ "identity": {"type": "str", "userAssignedIdentity": "str"},
+ }
+ ],
+ "tokenIssuer": "str",
+ },
+ },
+ "customDomains": [
+ {
+ "fullyQualifiedDomainName": "str",
+ "certificateUrl": "str",
+ "expectedTxtRecordName": "str",
+ "expectedTxtRecordValue": "str",
+ "identity": {"type": "str", "userAssignedIdentity": "str"},
+ "validationState": "str",
+ }
+ ],
+ "maximumClientSessionsPerAuthenticationName": 0,
+ "maximumSessionExpiryInHours": 0,
+ "routeTopicResourceId": "str",
+ "routingEnrichments": {
+ "dynamic": [{"key": "str", "value": "str"}],
+ "static": ["static_routing_enrichment"],
+ },
+ "routingIdentityInfo": {"type": "str", "userAssignedIdentity": "str"},
+ "state": "str",
+ },
+ "topicsConfiguration": {
+ "customDomains": [
+ {
+ "fullyQualifiedDomainName": "str",
+ "certificateUrl": "str",
+ "expectedTxtRecordName": "str",
+ "expectedTxtRecordValue": "str",
+ "identity": {"type": "str", "userAssignedIdentity": "str"},
+ "validationState": "str",
+ }
+ ]
+ },
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_namespaces_list_by_subscription(self, resource_group):
+ response = self.client.namespaces.list_by_subscription(
+ api_version="2024-12-15-preview",
+ )
+ 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_namespaces_list_by_resource_group(self, resource_group):
+ response = self.client.namespaces.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+ 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_namespaces_list_shared_access_keys(self, resource_group):
+ response = await self.client.namespaces.list_shared_access_keys(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_namespaces_begin_regenerate_key(self, resource_group):
+ response = await (
+ await self.client.namespaces.begin_regenerate_key(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ regenerate_key_request={"keyName": "str"},
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_namespaces_begin_validate_custom_domain_ownership(self, resource_group):
+ response = await (
+ await self.client.namespaces.begin_validate_custom_domain_ownership(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_network_security_perimeter_configurations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_network_security_perimeter_configurations_operations.py
new file mode 100644
index 000000000000..5050daa04077
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_network_security_perimeter_configurations_operations.py
@@ -0,0 +1,62 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementNetworkSecurityPerimeterConfigurationsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_network_security_perimeter_configurations_get(self, resource_group):
+ response = self.client.network_security_perimeter_configurations.get(
+ resource_group_name=resource_group.name,
+ resource_type="str",
+ resource_name="str",
+ perimeter_guid="str",
+ association_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_network_security_perimeter_configurations_begin_reconcile(self, resource_group):
+ response = self.client.network_security_perimeter_configurations.begin_reconcile(
+ resource_group_name=resource_group.name,
+ resource_type="str",
+ resource_name="str",
+ perimeter_guid="str",
+ association_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_network_security_perimeter_configurations_list(self, resource_group):
+ response = self.client.network_security_perimeter_configurations.list(
+ resource_group_name=resource_group.name,
+ resource_type="str",
+ resource_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_network_security_perimeter_configurations_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_network_security_perimeter_configurations_operations_async.py
new file mode 100644
index 000000000000..5429c1e3da87
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_network_security_perimeter_configurations_operations_async.py
@@ -0,0 +1,65 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementNetworkSecurityPerimeterConfigurationsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_network_security_perimeter_configurations_get(self, resource_group):
+ response = await self.client.network_security_perimeter_configurations.get(
+ resource_group_name=resource_group.name,
+ resource_type="str",
+ resource_name="str",
+ perimeter_guid="str",
+ association_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_network_security_perimeter_configurations_begin_reconcile(self, resource_group):
+ response = await (
+ await self.client.network_security_perimeter_configurations.begin_reconcile(
+ resource_group_name=resource_group.name,
+ resource_type="str",
+ resource_name="str",
+ perimeter_guid="str",
+ association_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_network_security_perimeter_configurations_list(self, resource_group):
+ response = self.client.network_security_perimeter_configurations.list(
+ resource_group_name=resource_group.name,
+ resource_type="str",
+ resource_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_operations.py
new file mode 100644
index 000000000000..5f7670f324ae
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_operations.py
@@ -0,0 +1,29 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_operations_list(self, resource_group):
+ response = self.client.operations.list(
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_operations_async.py
new file mode 100644
index 000000000000..87809a41da5d
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_operations_async.py
@@ -0,0 +1,30 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_operations_list(self, resource_group):
+ response = self.client.operations.list(
+ api_version="2024-12-15-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_configurations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_configurations_operations.py
new file mode 100644
index 000000000000..f247e0427672
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_configurations_operations.py
@@ -0,0 +1,143 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementPartnerConfigurationsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_configurations_get(self, resource_group):
+ response = self.client.partner_configurations.get(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_configurations_begin_create_or_update(self, resource_group):
+ response = self.client.partner_configurations.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ partner_configuration_info={
+ "id": "str",
+ "location": "str",
+ "name": "str",
+ "partnerAuthorization": {
+ "authorizedPartnersList": [
+ {
+ "authorizationExpirationTimeInUtc": "2020-02-20 00:00:00",
+ "partnerName": "str",
+ "partnerRegistrationImmutableId": "str",
+ }
+ ],
+ "defaultMaximumExpirationTimeInDays": 0,
+ },
+ "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",
+ },
+ "tags": {"str": "str"},
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_configurations_begin_delete(self, resource_group):
+ response = self.client.partner_configurations.begin_delete(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_configurations_begin_update(self, resource_group):
+ response = self.client.partner_configurations.begin_update(
+ resource_group_name=resource_group.name,
+ partner_configuration_update_parameters={"defaultMaximumExpirationTimeInDays": 0, "tags": {"str": "str"}},
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_configurations_list_by_resource_group(self, resource_group):
+ response = self.client.partner_configurations.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_configurations_list_by_subscription(self, resource_group):
+ response = self.client.partner_configurations.list_by_subscription(
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_configurations_authorize_partner(self, resource_group):
+ response = self.client.partner_configurations.authorize_partner(
+ resource_group_name=resource_group.name,
+ partner_info={
+ "authorizationExpirationTimeInUtc": "2020-02-20 00:00:00",
+ "partnerName": "str",
+ "partnerRegistrationImmutableId": "str",
+ },
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_configurations_unauthorize_partner(self, resource_group):
+ response = self.client.partner_configurations.unauthorize_partner(
+ resource_group_name=resource_group.name,
+ partner_info={
+ "authorizationExpirationTimeInUtc": "2020-02-20 00:00:00",
+ "partnerName": "str",
+ "partnerRegistrationImmutableId": "str",
+ },
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_configurations_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_configurations_operations_async.py
new file mode 100644
index 000000000000..6d9e0141df8f
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_configurations_operations_async.py
@@ -0,0 +1,153 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementPartnerConfigurationsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_configurations_get(self, resource_group):
+ response = await self.client.partner_configurations.get(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_configurations_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.partner_configurations.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ partner_configuration_info={
+ "id": "str",
+ "location": "str",
+ "name": "str",
+ "partnerAuthorization": {
+ "authorizedPartnersList": [
+ {
+ "authorizationExpirationTimeInUtc": "2020-02-20 00:00:00",
+ "partnerName": "str",
+ "partnerRegistrationImmutableId": "str",
+ }
+ ],
+ "defaultMaximumExpirationTimeInDays": 0,
+ },
+ "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",
+ },
+ "tags": {"str": "str"},
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_configurations_begin_delete(self, resource_group):
+ response = await (
+ await self.client.partner_configurations.begin_delete(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_configurations_begin_update(self, resource_group):
+ response = await (
+ await self.client.partner_configurations.begin_update(
+ resource_group_name=resource_group.name,
+ partner_configuration_update_parameters={
+ "defaultMaximumExpirationTimeInDays": 0,
+ "tags": {"str": "str"},
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_configurations_list_by_resource_group(self, resource_group):
+ response = self.client.partner_configurations.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+ 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_partner_configurations_list_by_subscription(self, resource_group):
+ response = self.client.partner_configurations.list_by_subscription(
+ api_version="2024-12-15-preview",
+ )
+ 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_partner_configurations_authorize_partner(self, resource_group):
+ response = await self.client.partner_configurations.authorize_partner(
+ resource_group_name=resource_group.name,
+ partner_info={
+ "authorizationExpirationTimeInUtc": "2020-02-20 00:00:00",
+ "partnerName": "str",
+ "partnerRegistrationImmutableId": "str",
+ },
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_configurations_unauthorize_partner(self, resource_group):
+ response = await self.client.partner_configurations.unauthorize_partner(
+ resource_group_name=resource_group.name,
+ partner_info={
+ "authorizationExpirationTimeInUtc": "2020-02-20 00:00:00",
+ "partnerName": "str",
+ "partnerRegistrationImmutableId": "str",
+ },
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_destinations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_destinations_operations.py
new file mode 100644
index 000000000000..25666d02250b
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_destinations_operations.py
@@ -0,0 +1,123 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementPartnerDestinationsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_destinations_get(self, resource_group):
+ response = self.client.partner_destinations.get(
+ resource_group_name=resource_group.name,
+ partner_destination_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_destinations_begin_create_or_update(self, resource_group):
+ response = self.client.partner_destinations.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ partner_destination_name="str",
+ partner_destination={
+ "location": "str",
+ "activationState": "str",
+ "endpointBaseUrl": "str",
+ "endpointServiceContext": "str",
+ "expirationTimeIfNotActivatedUtc": "2020-02-20 00:00:00",
+ "id": "str",
+ "messageForActivation": "str",
+ "name": "str",
+ "partnerRegistrationImmutableId": "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",
+ },
+ "tags": {"str": "str"},
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_destinations_begin_delete(self, resource_group):
+ response = self.client.partner_destinations.begin_delete(
+ resource_group_name=resource_group.name,
+ partner_destination_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_destinations_begin_update(self, resource_group):
+ response = self.client.partner_destinations.begin_update(
+ resource_group_name=resource_group.name,
+ partner_destination_name="str",
+ partner_destination_update_parameters={"tags": {"str": "str"}},
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_destinations_list_by_subscription(self, resource_group):
+ response = self.client.partner_destinations.list_by_subscription(
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_destinations_list_by_resource_group(self, resource_group):
+ response = self.client.partner_destinations.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_destinations_activate(self, resource_group):
+ response = self.client.partner_destinations.activate(
+ resource_group_name=resource_group.name,
+ partner_destination_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_destinations_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_destinations_operations_async.py
new file mode 100644
index 000000000000..91c2ccdf09ef
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_destinations_operations_async.py
@@ -0,0 +1,130 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementPartnerDestinationsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_destinations_get(self, resource_group):
+ response = await self.client.partner_destinations.get(
+ resource_group_name=resource_group.name,
+ partner_destination_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_destinations_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.partner_destinations.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ partner_destination_name="str",
+ partner_destination={
+ "location": "str",
+ "activationState": "str",
+ "endpointBaseUrl": "str",
+ "endpointServiceContext": "str",
+ "expirationTimeIfNotActivatedUtc": "2020-02-20 00:00:00",
+ "id": "str",
+ "messageForActivation": "str",
+ "name": "str",
+ "partnerRegistrationImmutableId": "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",
+ },
+ "tags": {"str": "str"},
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_destinations_begin_delete(self, resource_group):
+ response = await (
+ await self.client.partner_destinations.begin_delete(
+ resource_group_name=resource_group.name,
+ partner_destination_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_destinations_begin_update(self, resource_group):
+ response = await (
+ await self.client.partner_destinations.begin_update(
+ resource_group_name=resource_group.name,
+ partner_destination_name="str",
+ partner_destination_update_parameters={"tags": {"str": "str"}},
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_destinations_list_by_subscription(self, resource_group):
+ response = self.client.partner_destinations.list_by_subscription(
+ api_version="2024-12-15-preview",
+ )
+ 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_partner_destinations_list_by_resource_group(self, resource_group):
+ response = self.client.partner_destinations.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+ 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_partner_destinations_activate(self, resource_group):
+ response = await self.client.partner_destinations.activate(
+ resource_group_name=resource_group.name,
+ partner_destination_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_namespaces_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_namespaces_operations.py
new file mode 100644
index 000000000000..d43ef5078926
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_namespaces_operations.py
@@ -0,0 +1,158 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementPartnerNamespacesOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_namespaces_get(self, resource_group):
+ response = self.client.partner_namespaces.get(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_namespaces_begin_create_or_update(self, resource_group):
+ response = self.client.partner_namespaces.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ partner_namespace_info={
+ "location": "str",
+ "disableLocalAuth": False,
+ "endpoint": "str",
+ "id": "str",
+ "inboundIpRules": [{"action": "str", "ipMask": "str"}],
+ "minimumTlsVersionAllowed": "str",
+ "name": "str",
+ "partnerRegistrationFullyQualifiedId": "str",
+ "partnerTopicRoutingMode": "SourceEventAttribute",
+ "privateEndpointConnections": [
+ {
+ "groupIds": ["str"],
+ "id": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {
+ "actionsRequired": "str",
+ "description": "str",
+ "status": "str",
+ },
+ "provisioningState": "str",
+ "type": "str",
+ }
+ ],
+ "provisioningState": "str",
+ "publicNetworkAccess": "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",
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_namespaces_begin_delete(self, resource_group):
+ response = self.client.partner_namespaces.begin_delete(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_namespaces_begin_update(self, resource_group):
+ response = self.client.partner_namespaces.begin_update(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ partner_namespace_update_parameters={
+ "disableLocalAuth": bool,
+ "inboundIpRules": [{"action": "str", "ipMask": "str"}],
+ "minimumTlsVersionAllowed": "str",
+ "publicNetworkAccess": "str",
+ "tags": {"str": "str"},
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_namespaces_list_by_subscription(self, resource_group):
+ response = self.client.partner_namespaces.list_by_subscription(
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_namespaces_list_by_resource_group(self, resource_group):
+ response = self.client.partner_namespaces.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_namespaces_list_shared_access_keys(self, resource_group):
+ response = self.client.partner_namespaces.list_shared_access_keys(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_namespaces_regenerate_key(self, resource_group):
+ response = self.client.partner_namespaces.regenerate_key(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ regenerate_key_request={"keyName": "str"},
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_namespaces_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_namespaces_operations_async.py
new file mode 100644
index 000000000000..c1c50724e4d1
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_namespaces_operations_async.py
@@ -0,0 +1,165 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementPartnerNamespacesOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_namespaces_get(self, resource_group):
+ response = await self.client.partner_namespaces.get(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_namespaces_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.partner_namespaces.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ partner_namespace_info={
+ "location": "str",
+ "disableLocalAuth": False,
+ "endpoint": "str",
+ "id": "str",
+ "inboundIpRules": [{"action": "str", "ipMask": "str"}],
+ "minimumTlsVersionAllowed": "str",
+ "name": "str",
+ "partnerRegistrationFullyQualifiedId": "str",
+ "partnerTopicRoutingMode": "SourceEventAttribute",
+ "privateEndpointConnections": [
+ {
+ "groupIds": ["str"],
+ "id": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {
+ "actionsRequired": "str",
+ "description": "str",
+ "status": "str",
+ },
+ "provisioningState": "str",
+ "type": "str",
+ }
+ ],
+ "provisioningState": "str",
+ "publicNetworkAccess": "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",
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_namespaces_begin_delete(self, resource_group):
+ response = await (
+ await self.client.partner_namespaces.begin_delete(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_namespaces_begin_update(self, resource_group):
+ response = await (
+ await self.client.partner_namespaces.begin_update(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ partner_namespace_update_parameters={
+ "disableLocalAuth": bool,
+ "inboundIpRules": [{"action": "str", "ipMask": "str"}],
+ "minimumTlsVersionAllowed": "str",
+ "publicNetworkAccess": "str",
+ "tags": {"str": "str"},
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_namespaces_list_by_subscription(self, resource_group):
+ response = self.client.partner_namespaces.list_by_subscription(
+ api_version="2024-12-15-preview",
+ )
+ 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_partner_namespaces_list_by_resource_group(self, resource_group):
+ response = self.client.partner_namespaces.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+ 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_partner_namespaces_list_shared_access_keys(self, resource_group):
+ response = await self.client.partner_namespaces.list_shared_access_keys(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_namespaces_regenerate_key(self, resource_group):
+ response = await self.client.partner_namespaces.regenerate_key(
+ resource_group_name=resource_group.name,
+ partner_namespace_name="str",
+ regenerate_key_request={"keyName": "str"},
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_registrations_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_registrations_operations.py
new file mode 100644
index 000000000000..80cb4722bcb0
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_registrations_operations.py
@@ -0,0 +1,106 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementPartnerRegistrationsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_registrations_get(self, resource_group):
+ response = self.client.partner_registrations.get(
+ resource_group_name=resource_group.name,
+ partner_registration_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_registrations_begin_create_or_update(self, resource_group):
+ response = self.client.partner_registrations.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ partner_registration_name="str",
+ partner_registration_info={
+ "location": "str",
+ "id": "str",
+ "name": "str",
+ "partnerRegistrationImmutableId": "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",
+ },
+ "tags": {"str": "str"},
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_registrations_begin_delete(self, resource_group):
+ response = self.client.partner_registrations.begin_delete(
+ resource_group_name=resource_group.name,
+ partner_registration_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_registrations_begin_update(self, resource_group):
+ response = self.client.partner_registrations.begin_update(
+ resource_group_name=resource_group.name,
+ partner_registration_name="str",
+ partner_registration_update_parameters={"tags": {"str": "str"}},
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_registrations_list_by_subscription(self, resource_group):
+ response = self.client.partner_registrations.list_by_subscription(
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_registrations_list_by_resource_group(self, resource_group):
+ response = self.client.partner_registrations.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_registrations_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_registrations_operations_async.py
new file mode 100644
index 000000000000..849a735e71e6
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_registrations_operations_async.py
@@ -0,0 +1,113 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementPartnerRegistrationsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_registrations_get(self, resource_group):
+ response = await self.client.partner_registrations.get(
+ resource_group_name=resource_group.name,
+ partner_registration_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_registrations_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.partner_registrations.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ partner_registration_name="str",
+ partner_registration_info={
+ "location": "str",
+ "id": "str",
+ "name": "str",
+ "partnerRegistrationImmutableId": "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",
+ },
+ "tags": {"str": "str"},
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_registrations_begin_delete(self, resource_group):
+ response = await (
+ await self.client.partner_registrations.begin_delete(
+ resource_group_name=resource_group.name,
+ partner_registration_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_registrations_begin_update(self, resource_group):
+ response = await (
+ await self.client.partner_registrations.begin_update(
+ resource_group_name=resource_group.name,
+ partner_registration_name="str",
+ partner_registration_update_parameters={"tags": {"str": "str"}},
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_registrations_list_by_subscription(self, resource_group):
+ response = self.client.partner_registrations.list_by_subscription(
+ api_version="2024-12-15-preview",
+ )
+ 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_partner_registrations_list_by_resource_group(self, resource_group):
+ response = self.client.partner_registrations.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topic_event_subscriptions_operations.py
new file mode 100644
index 000000000000..5b28678a35a0
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topic_event_subscriptions_operations.py
@@ -0,0 +1,186 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementPartnerTopicEventSubscriptionsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_topic_event_subscriptions_get(self, resource_group):
+ response = self.client.partner_topic_event_subscriptions.get(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_topic_event_subscriptions_begin_create_or_update(self, resource_group):
+ response = self.client.partner_topic_event_subscriptions.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ event_subscription_name="str",
+ event_subscription_info={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "id": "str",
+ "labels": ["str"],
+ "name": "str",
+ "provisioningState": "str",
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "topic": "str",
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_topic_event_subscriptions_begin_delete(self, resource_group):
+ response = self.client.partner_topic_event_subscriptions.begin_delete(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_topic_event_subscriptions_begin_update(self, resource_group):
+ response = self.client.partner_topic_event_subscriptions.begin_update(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ event_subscription_name="str",
+ event_subscription_update_parameters={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "labels": ["str"],
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_topic_event_subscriptions_get_full_url(self, resource_group):
+ response = self.client.partner_topic_event_subscriptions.get_full_url(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_topic_event_subscriptions_list_by_partner_topic(self, resource_group):
+ response = self.client.partner_topic_event_subscriptions.list_by_partner_topic(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_topic_event_subscriptions_get_delivery_attributes(self, resource_group):
+ response = self.client.partner_topic_event_subscriptions.get_delivery_attributes(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topic_event_subscriptions_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topic_event_subscriptions_operations_async.py
new file mode 100644
index 000000000000..21b7d509588d
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topic_event_subscriptions_operations_async.py
@@ -0,0 +1,193 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementPartnerTopicEventSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_topic_event_subscriptions_get(self, resource_group):
+ response = await self.client.partner_topic_event_subscriptions.get(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_topic_event_subscriptions_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.partner_topic_event_subscriptions.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ event_subscription_name="str",
+ event_subscription_info={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "id": "str",
+ "labels": ["str"],
+ "name": "str",
+ "provisioningState": "str",
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "topic": "str",
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_topic_event_subscriptions_begin_delete(self, resource_group):
+ response = await (
+ await self.client.partner_topic_event_subscriptions.begin_delete(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_topic_event_subscriptions_begin_update(self, resource_group):
+ response = await (
+ await self.client.partner_topic_event_subscriptions.begin_update(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ event_subscription_name="str",
+ event_subscription_update_parameters={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "labels": ["str"],
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_topic_event_subscriptions_get_full_url(self, resource_group):
+ response = await self.client.partner_topic_event_subscriptions.get_full_url(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_topic_event_subscriptions_list_by_partner_topic(self, resource_group):
+ response = self.client.partner_topic_event_subscriptions.list_by_partner_topic(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+ 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_partner_topic_event_subscriptions_get_delivery_attributes(self, resource_group):
+ response = await self.client.partner_topic_event_subscriptions.get_delivery_attributes(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topics_operations.py
new file mode 100644
index 000000000000..9239f6ac84db
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topics_operations.py
@@ -0,0 +1,160 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementPartnerTopicsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_topics_get(self, resource_group):
+ response = self.client.partner_topics.get(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_topics_create_or_update(self, resource_group):
+ response = self.client.partner_topics.create_or_update(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ partner_topic_info={
+ "location": "str",
+ "activationState": "str",
+ "eventTypeInfo": {
+ "inlineEventTypes": {
+ "str": {
+ "dataSchemaUrl": "str",
+ "description": "str",
+ "displayName": "str",
+ "documentationUrl": "str",
+ }
+ },
+ "kind": "str",
+ },
+ "expirationTimeIfNotActivatedUtc": "2020-02-20 00:00:00",
+ "id": "str",
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "messageForActivation": "str",
+ "name": "str",
+ "partnerRegistrationImmutableId": "str",
+ "partnerTopicFriendlyDescription": "str",
+ "provisioningState": "str",
+ "source": "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",
+ },
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_topics_begin_delete(self, resource_group):
+ response = self.client.partner_topics.begin_delete(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_topics_update(self, resource_group):
+ response = self.client.partner_topics.update(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ partner_topic_update_parameters={
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "tags": {"str": "str"},
+ },
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_topics_list_by_subscription(self, resource_group):
+ response = self.client.partner_topics.list_by_subscription(
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_topics_list_by_resource_group(self, resource_group):
+ response = self.client.partner_topics.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_topics_activate(self, resource_group):
+ response = self.client.partner_topics.activate(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_partner_topics_deactivate(self, resource_group):
+ response = self.client.partner_topics.deactivate(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topics_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topics_operations_async.py
new file mode 100644
index 000000000000..c65d2160dad6
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_partner_topics_operations_async.py
@@ -0,0 +1,163 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementPartnerTopicsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_topics_get(self, resource_group):
+ response = await self.client.partner_topics.get(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_topics_create_or_update(self, resource_group):
+ response = await self.client.partner_topics.create_or_update(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ partner_topic_info={
+ "location": "str",
+ "activationState": "str",
+ "eventTypeInfo": {
+ "inlineEventTypes": {
+ "str": {
+ "dataSchemaUrl": "str",
+ "description": "str",
+ "displayName": "str",
+ "documentationUrl": "str",
+ }
+ },
+ "kind": "str",
+ },
+ "expirationTimeIfNotActivatedUtc": "2020-02-20 00:00:00",
+ "id": "str",
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "messageForActivation": "str",
+ "name": "str",
+ "partnerRegistrationImmutableId": "str",
+ "partnerTopicFriendlyDescription": "str",
+ "provisioningState": "str",
+ "source": "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",
+ },
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_topics_begin_delete(self, resource_group):
+ response = await (
+ await self.client.partner_topics.begin_delete(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_topics_update(self, resource_group):
+ response = await self.client.partner_topics.update(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ partner_topic_update_parameters={
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "tags": {"str": "str"},
+ },
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_topics_list_by_subscription(self, resource_group):
+ response = self.client.partner_topics.list_by_subscription(
+ api_version="2024-12-15-preview",
+ )
+ 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_partner_topics_list_by_resource_group(self, resource_group):
+ response = self.client.partner_topics.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+ 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_partner_topics_activate(self, resource_group):
+ response = await self.client.partner_topics.activate(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_partner_topics_deactivate(self, resource_group):
+ response = await self.client.partner_topics.deactivate(
+ resource_group_name=resource_group.name,
+ partner_topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_permission_bindings_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_permission_bindings_operations.py
new file mode 100644
index 000000000000..7b775c390818
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_permission_bindings_operations.py
@@ -0,0 +1,88 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementPermissionBindingsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_permission_bindings_get(self, resource_group):
+ response = self.client.permission_bindings.get(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ permission_binding_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_permission_bindings_begin_create_or_update(self, resource_group):
+ response = self.client.permission_bindings.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ permission_binding_name="str",
+ permission_binding_info={
+ "clientGroupName": "str",
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "permission": "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",
+ },
+ "topicSpaceName": "str",
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_permission_bindings_begin_delete(self, resource_group):
+ response = self.client.permission_bindings.begin_delete(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ permission_binding_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_permission_bindings_list_by_namespace(self, resource_group):
+ response = self.client.permission_bindings.list_by_namespace(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_permission_bindings_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_permission_bindings_operations_async.py
new file mode 100644
index 000000000000..e7cb981d8a29
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_permission_bindings_operations_async.py
@@ -0,0 +1,93 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementPermissionBindingsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_permission_bindings_get(self, resource_group):
+ response = await self.client.permission_bindings.get(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ permission_binding_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_permission_bindings_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.permission_bindings.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ permission_binding_name="str",
+ permission_binding_info={
+ "clientGroupName": "str",
+ "description": "str",
+ "id": "str",
+ "name": "str",
+ "permission": "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",
+ },
+ "topicSpaceName": "str",
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_permission_bindings_begin_delete(self, resource_group):
+ response = await (
+ await self.client.permission_bindings.begin_delete(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ permission_binding_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_permission_bindings_list_by_namespace(self, resource_group):
+ response = self.client.permission_bindings.list_by_namespace(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_endpoint_connections_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_endpoint_connections_operations.py
new file mode 100644
index 000000000000..d70e53addde7
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_endpoint_connections_operations.py
@@ -0,0 +1,83 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementPrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_private_endpoint_connections_get(self, resource_group):
+ response = self.client.private_endpoint_connections.get(
+ resource_group_name=resource_group.name,
+ parent_type="str",
+ parent_name="str",
+ private_endpoint_connection_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_private_endpoint_connections_begin_update(self, resource_group):
+ response = self.client.private_endpoint_connections.begin_update(
+ resource_group_name=resource_group.name,
+ parent_type="str",
+ parent_name="str",
+ private_endpoint_connection_name="str",
+ private_endpoint_connection={
+ "groupIds": ["str"],
+ "id": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"},
+ "provisioningState": "str",
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_private_endpoint_connections_begin_delete(self, resource_group):
+ response = self.client.private_endpoint_connections.begin_delete(
+ resource_group_name=resource_group.name,
+ parent_type="str",
+ parent_name="str",
+ private_endpoint_connection_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_private_endpoint_connections_list_by_resource(self, resource_group):
+ response = self.client.private_endpoint_connections.list_by_resource(
+ resource_group_name=resource_group.name,
+ parent_type="str",
+ parent_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_endpoint_connections_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_endpoint_connections_operations_async.py
new file mode 100644
index 000000000000..23918697aab1
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_endpoint_connections_operations_async.py
@@ -0,0 +1,92 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementPrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_private_endpoint_connections_get(self, resource_group):
+ response = await self.client.private_endpoint_connections.get(
+ resource_group_name=resource_group.name,
+ parent_type="str",
+ parent_name="str",
+ private_endpoint_connection_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_private_endpoint_connections_begin_update(self, resource_group):
+ response = await (
+ await self.client.private_endpoint_connections.begin_update(
+ resource_group_name=resource_group.name,
+ parent_type="str",
+ parent_name="str",
+ private_endpoint_connection_name="str",
+ private_endpoint_connection={
+ "groupIds": ["str"],
+ "id": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {
+ "actionsRequired": "str",
+ "description": "str",
+ "status": "str",
+ },
+ "provisioningState": "str",
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_private_endpoint_connections_begin_delete(self, resource_group):
+ response = await (
+ await self.client.private_endpoint_connections.begin_delete(
+ resource_group_name=resource_group.name,
+ parent_type="str",
+ parent_name="str",
+ private_endpoint_connection_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_private_endpoint_connections_list_by_resource(self, resource_group):
+ response = self.client.private_endpoint_connections.list_by_resource(
+ resource_group_name=resource_group.name,
+ parent_type="str",
+ parent_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_link_resources_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_link_resources_operations.py
new file mode 100644
index 000000000000..e1a51d7a618f
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_link_resources_operations.py
@@ -0,0 +1,46 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementPrivateLinkResourcesOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_private_link_resources_get(self, resource_group):
+ response = self.client.private_link_resources.get(
+ resource_group_name=resource_group.name,
+ parent_type="str",
+ parent_name="str",
+ private_link_resource_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_private_link_resources_list_by_resource(self, resource_group):
+ response = self.client.private_link_resources.list_by_resource(
+ resource_group_name=resource_group.name,
+ parent_type="str",
+ parent_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_link_resources_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_link_resources_operations_async.py
new file mode 100644
index 000000000000..620272662068
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_private_link_resources_operations_async.py
@@ -0,0 +1,47 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementPrivateLinkResourcesOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_private_link_resources_get(self, resource_group):
+ response = await self.client.private_link_resources.get(
+ resource_group_name=resource_group.name,
+ parent_type="str",
+ parent_name="str",
+ private_link_resource_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_private_link_resources_list_by_resource(self, resource_group):
+ response = self.client.private_link_resources.list_by_resource(
+ resource_group_name=resource_group.name,
+ parent_type="str",
+ parent_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topic_event_subscriptions_operations.py
new file mode 100644
index 000000000000..a7d0e0f4e062
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topic_event_subscriptions_operations.py
@@ -0,0 +1,186 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementSystemTopicEventSubscriptionsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_system_topic_event_subscriptions_get_delivery_attributes(self, resource_group):
+ response = self.client.system_topic_event_subscriptions.get_delivery_attributes(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_system_topic_event_subscriptions_get(self, resource_group):
+ response = self.client.system_topic_event_subscriptions.get(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_system_topic_event_subscriptions_begin_create_or_update(self, resource_group):
+ response = self.client.system_topic_event_subscriptions.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ event_subscription_name="str",
+ event_subscription_info={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "id": "str",
+ "labels": ["str"],
+ "name": "str",
+ "provisioningState": "str",
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "topic": "str",
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_system_topic_event_subscriptions_begin_delete(self, resource_group):
+ response = self.client.system_topic_event_subscriptions.begin_delete(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_system_topic_event_subscriptions_begin_update(self, resource_group):
+ response = self.client.system_topic_event_subscriptions.begin_update(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ event_subscription_name="str",
+ event_subscription_update_parameters={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "labels": ["str"],
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_system_topic_event_subscriptions_get_full_url(self, resource_group):
+ response = self.client.system_topic_event_subscriptions.get_full_url(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_system_topic_event_subscriptions_list_by_system_topic(self, resource_group):
+ response = self.client.system_topic_event_subscriptions.list_by_system_topic(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topic_event_subscriptions_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topic_event_subscriptions_operations_async.py
new file mode 100644
index 000000000000..b99aaa3345c2
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topic_event_subscriptions_operations_async.py
@@ -0,0 +1,193 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementSystemTopicEventSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_system_topic_event_subscriptions_get_delivery_attributes(self, resource_group):
+ response = await self.client.system_topic_event_subscriptions.get_delivery_attributes(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_system_topic_event_subscriptions_get(self, resource_group):
+ response = await self.client.system_topic_event_subscriptions.get(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_system_topic_event_subscriptions_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.system_topic_event_subscriptions.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ event_subscription_name="str",
+ event_subscription_info={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "id": "str",
+ "labels": ["str"],
+ "name": "str",
+ "provisioningState": "str",
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "topic": "str",
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_system_topic_event_subscriptions_begin_delete(self, resource_group):
+ response = await (
+ await self.client.system_topic_event_subscriptions.begin_delete(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_system_topic_event_subscriptions_begin_update(self, resource_group):
+ response = await (
+ await self.client.system_topic_event_subscriptions.begin_update(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ event_subscription_name="str",
+ event_subscription_update_parameters={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "labels": ["str"],
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_system_topic_event_subscriptions_get_full_url(self, resource_group):
+ response = await self.client.system_topic_event_subscriptions.get_full_url(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_system_topic_event_subscriptions_list_by_system_topic(self, resource_group):
+ response = self.client.system_topic_event_subscriptions.list_by_system_topic(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topics_operations.py
new file mode 100644
index 000000000000..674377809afc
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topics_operations.py
@@ -0,0 +1,122 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementSystemTopicsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_system_topics_get(self, resource_group):
+ response = self.client.system_topics.get(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_system_topics_begin_create_or_update(self, resource_group):
+ response = self.client.system_topics.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ system_topic_info={
+ "location": "str",
+ "id": "str",
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "metricResourceId": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "source": "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"},
+ "topicType": "str",
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_system_topics_begin_delete(self, resource_group):
+ response = self.client.system_topics.begin_delete(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_system_topics_begin_update(self, resource_group):
+ response = self.client.system_topics.begin_update(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ system_topic_update_parameters={
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "tags": {"str": "str"},
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_system_topics_list_by_subscription(self, resource_group):
+ response = self.client.system_topics.list_by_subscription(
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_system_topics_list_by_resource_group(self, resource_group):
+ response = self.client.system_topics.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topics_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topics_operations_async.py
new file mode 100644
index 000000000000..7a55714e452c
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_system_topics_operations_async.py
@@ -0,0 +1,129 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementSystemTopicsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_system_topics_get(self, resource_group):
+ response = await self.client.system_topics.get(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_system_topics_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.system_topics.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ system_topic_info={
+ "location": "str",
+ "id": "str",
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "metricResourceId": "str",
+ "name": "str",
+ "provisioningState": "str",
+ "source": "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"},
+ "topicType": "str",
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_system_topics_begin_delete(self, resource_group):
+ response = await (
+ await self.client.system_topics.begin_delete(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_system_topics_begin_update(self, resource_group):
+ response = await (
+ await self.client.system_topics.begin_update(
+ resource_group_name=resource_group.name,
+ system_topic_name="str",
+ system_topic_update_parameters={
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "tags": {"str": "str"},
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_system_topics_list_by_subscription(self, resource_group):
+ response = self.client.system_topics.list_by_subscription(
+ api_version="2024-12-15-preview",
+ )
+ 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_system_topics_list_by_resource_group(self, resource_group):
+ response = self.client.system_topics.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_event_subscriptions_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_event_subscriptions_operations.py
new file mode 100644
index 000000000000..c47065cfd407
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_event_subscriptions_operations.py
@@ -0,0 +1,186 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementTopicEventSubscriptionsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topic_event_subscriptions_get_delivery_attributes(self, resource_group):
+ response = self.client.topic_event_subscriptions.get_delivery_attributes(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topic_event_subscriptions_get(self, resource_group):
+ response = self.client.topic_event_subscriptions.get(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topic_event_subscriptions_begin_create_or_update(self, resource_group):
+ response = self.client.topic_event_subscriptions.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ event_subscription_name="str",
+ event_subscription_info={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "id": "str",
+ "labels": ["str"],
+ "name": "str",
+ "provisioningState": "str",
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "topic": "str",
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topic_event_subscriptions_begin_delete(self, resource_group):
+ response = self.client.topic_event_subscriptions.begin_delete(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topic_event_subscriptions_begin_update(self, resource_group):
+ response = self.client.topic_event_subscriptions.begin_update(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ event_subscription_name="str",
+ event_subscription_update_parameters={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "labels": ["str"],
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topic_event_subscriptions_get_full_url(self, resource_group):
+ response = self.client.topic_event_subscriptions.get_full_url(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topic_event_subscriptions_list(self, resource_group):
+ response = self.client.topic_event_subscriptions.list(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_event_subscriptions_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_event_subscriptions_operations_async.py
new file mode 100644
index 000000000000..d4eddcb34738
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_event_subscriptions_operations_async.py
@@ -0,0 +1,193 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementTopicEventSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_topic_event_subscriptions_get_delivery_attributes(self, resource_group):
+ response = await self.client.topic_event_subscriptions.get_delivery_attributes(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_topic_event_subscriptions_get(self, resource_group):
+ response = await self.client.topic_event_subscriptions.get(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_topic_event_subscriptions_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.topic_event_subscriptions.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ event_subscription_name="str",
+ event_subscription_info={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "id": "str",
+ "labels": ["str"],
+ "name": "str",
+ "provisioningState": "str",
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ "systemData": {
+ "createdAt": "2020-02-20 00:00:00",
+ "createdBy": "str",
+ "createdByType": "str",
+ "lastModifiedAt": "2020-02-20 00:00:00",
+ "lastModifiedBy": "str",
+ "lastModifiedByType": "str",
+ },
+ "topic": "str",
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_topic_event_subscriptions_begin_delete(self, resource_group):
+ response = await (
+ await self.client.topic_event_subscriptions.begin_delete(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_topic_event_subscriptions_begin_update(self, resource_group):
+ response = await (
+ await self.client.topic_event_subscriptions.begin_update(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ event_subscription_name="str",
+ event_subscription_update_parameters={
+ "deadLetterDestination": "dead_letter_destination",
+ "deadLetterWithResourceIdentity": {
+ "deadLetterDestination": "dead_letter_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "deliveryWithResourceIdentity": {
+ "destination": "event_subscription_destination",
+ "identity": {
+ "federatedIdentityCredentialInfo": {"federatedClientId": "str"},
+ "type": "str",
+ "userAssignedIdentity": "str",
+ },
+ },
+ "destination": "event_subscription_destination",
+ "eventDeliverySchema": "str",
+ "expirationTimeUtc": "2020-02-20 00:00:00",
+ "filter": {
+ "advancedFilters": ["advanced_filter"],
+ "enableAdvancedFilteringOnArrays": bool,
+ "includedEventTypes": ["str"],
+ "isSubjectCaseSensitive": False,
+ "subjectBeginsWith": "str",
+ "subjectEndsWith": "str",
+ },
+ "labels": ["str"],
+ "retryPolicy": {"eventTimeToLiveInMinutes": 1440, "maxDeliveryAttempts": 30},
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_topic_event_subscriptions_get_full_url(self, resource_group):
+ response = await self.client.topic_event_subscriptions.get_full_url(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ event_subscription_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_topic_event_subscriptions_list(self, resource_group):
+ response = self.client.topic_event_subscriptions.list(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_spaces_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_spaces_operations.py
new file mode 100644
index 000000000000..4625d24ca67e
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_spaces_operations.py
@@ -0,0 +1,86 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementTopicSpacesOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topic_spaces_get(self, resource_group):
+ response = self.client.topic_spaces.get(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_space_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topic_spaces_begin_create_or_update(self, resource_group):
+ response = self.client.topic_spaces.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_space_name="str",
+ topic_space_info={
+ "description": "str",
+ "id": "str",
+ "name": "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",
+ },
+ "topicTemplates": ["str"],
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topic_spaces_begin_delete(self, resource_group):
+ response = self.client.topic_spaces.begin_delete(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_space_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topic_spaces_list_by_namespace(self, resource_group):
+ response = self.client.topic_spaces.list_by_namespace(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_spaces_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_spaces_operations_async.py
new file mode 100644
index 000000000000..1b4447f8e715
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_spaces_operations_async.py
@@ -0,0 +1,91 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementTopicSpacesOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_topic_spaces_get(self, resource_group):
+ response = await self.client.topic_spaces.get(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_space_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_topic_spaces_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.topic_spaces.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_space_name="str",
+ topic_space_info={
+ "description": "str",
+ "id": "str",
+ "name": "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",
+ },
+ "topicTemplates": ["str"],
+ "type": "str",
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_topic_spaces_begin_delete(self, resource_group):
+ response = await (
+ await self.client.topic_spaces.begin_delete(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ topic_space_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_topic_spaces_list_by_namespace(self, resource_group):
+ response = self.client.topic_spaces.list_by_namespace(
+ resource_group_name=resource_group.name,
+ namespace_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_types_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_types_operations.py
new file mode 100644
index 000000000000..002deee4c930
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_types_operations.py
@@ -0,0 +1,51 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementTopicTypesOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topic_types_list(self, resource_group):
+ response = self.client.topic_types.list(
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topic_types_get(self, resource_group):
+ response = self.client.topic_types.get(
+ topic_type_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topic_types_list_event_types(self, resource_group):
+ response = self.client.topic_types.list_event_types(
+ topic_type_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_types_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_types_operations_async.py
new file mode 100644
index 000000000000..5e32d3639c33
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topic_types_operations_async.py
@@ -0,0 +1,52 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementTopicTypesOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_topic_types_list(self, resource_group):
+ response = self.client.topic_types.list(
+ api_version="2024-12-15-preview",
+ )
+ 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_topic_types_get(self, resource_group):
+ response = await self.client.topic_types.get(
+ topic_type_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_topic_types_list_event_types(self, resource_group):
+ response = self.client.topic_types.list_event_types(
+ topic_type_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topics_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topics_operations.py
new file mode 100644
index 000000000000..996ab86bd57b
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topics_operations.py
@@ -0,0 +1,213 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementTopicsOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topics_get(self, resource_group):
+ response = self.client.topics.get(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topics_begin_create_or_update(self, resource_group):
+ response = self.client.topics.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ topic_info={
+ "location": "str",
+ "dataResidencyBoundary": "str",
+ "disableLocalAuth": False,
+ "endpoint": "str",
+ "eventTypeInfo": {
+ "inlineEventTypes": {
+ "str": {
+ "dataSchemaUrl": "str",
+ "description": "str",
+ "displayName": "str",
+ "documentationUrl": "str",
+ }
+ },
+ "kind": "str",
+ },
+ "extendedLocation": {"name": "str", "type": "str"},
+ "id": "str",
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "inboundIpRules": [{"action": "str", "ipMask": "str"}],
+ "inputSchema": "str",
+ "inputSchemaMapping": "input_schema_mapping",
+ "kind": "Azure",
+ "metricResourceId": "str",
+ "minimumTlsVersionAllowed": "str",
+ "name": "str",
+ "privateEndpointConnections": [
+ {
+ "groupIds": ["str"],
+ "id": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {
+ "actionsRequired": "str",
+ "description": "str",
+ "status": "str",
+ },
+ "provisioningState": "str",
+ "type": "str",
+ }
+ ],
+ "provisioningState": "str",
+ "publicNetworkAccess": "str",
+ "sku": {"name": "Basic"},
+ "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",
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topics_begin_delete(self, resource_group):
+ response = self.client.topics.begin_delete(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topics_begin_update(self, resource_group):
+ response = self.client.topics.begin_update(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ topic_update_parameters={
+ "dataResidencyBoundary": "str",
+ "disableLocalAuth": bool,
+ "eventTypeInfo": {
+ "inlineEventTypes": {
+ "str": {
+ "dataSchemaUrl": "str",
+ "description": "str",
+ "displayName": "str",
+ "documentationUrl": "str",
+ }
+ },
+ "kind": "str",
+ },
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "inboundIpRules": [{"action": "str", "ipMask": "str"}],
+ "minimumTlsVersionAllowed": "str",
+ "publicNetworkAccess": "str",
+ "sku": {"name": "Basic"},
+ "tags": {"str": "str"},
+ },
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topics_list_by_subscription(self, resource_group):
+ response = self.client.topics.list_by_subscription(
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topics_list_by_resource_group(self, resource_group):
+ response = self.client.topics.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topics_list_shared_access_keys(self, resource_group):
+ response = self.client.topics.list_shared_access_keys(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topics_begin_regenerate_key(self, resource_group):
+ response = self.client.topics.begin_regenerate_key(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ regenerate_key_request={"keyName": "str"},
+ api_version="2024-12-15-preview",
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_topics_list_event_types(self, resource_group):
+ response = self.client.topics.list_event_types(
+ resource_group_name=resource_group.name,
+ provider_namespace="str",
+ resource_type_name="str",
+ resource_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topics_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topics_operations_async.py
new file mode 100644
index 000000000000..0c0a64f53ebf
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_topics_operations_async.py
@@ -0,0 +1,222 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementTopicsOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_topics_get(self, resource_group):
+ response = await self.client.topics.get(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_topics_begin_create_or_update(self, resource_group):
+ response = await (
+ await self.client.topics.begin_create_or_update(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ topic_info={
+ "location": "str",
+ "dataResidencyBoundary": "str",
+ "disableLocalAuth": False,
+ "endpoint": "str",
+ "eventTypeInfo": {
+ "inlineEventTypes": {
+ "str": {
+ "dataSchemaUrl": "str",
+ "description": "str",
+ "displayName": "str",
+ "documentationUrl": "str",
+ }
+ },
+ "kind": "str",
+ },
+ "extendedLocation": {"name": "str", "type": "str"},
+ "id": "str",
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "inboundIpRules": [{"action": "str", "ipMask": "str"}],
+ "inputSchema": "str",
+ "inputSchemaMapping": "input_schema_mapping",
+ "kind": "Azure",
+ "metricResourceId": "str",
+ "minimumTlsVersionAllowed": "str",
+ "name": "str",
+ "privateEndpointConnections": [
+ {
+ "groupIds": ["str"],
+ "id": "str",
+ "name": "str",
+ "privateEndpoint": {"id": "str"},
+ "privateLinkServiceConnectionState": {
+ "actionsRequired": "str",
+ "description": "str",
+ "status": "str",
+ },
+ "provisioningState": "str",
+ "type": "str",
+ }
+ ],
+ "provisioningState": "str",
+ "publicNetworkAccess": "str",
+ "sku": {"name": "Basic"},
+ "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",
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_topics_begin_delete(self, resource_group):
+ response = await (
+ await self.client.topics.begin_delete(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_topics_begin_update(self, resource_group):
+ response = await (
+ await self.client.topics.begin_update(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ topic_update_parameters={
+ "dataResidencyBoundary": "str",
+ "disableLocalAuth": bool,
+ "eventTypeInfo": {
+ "inlineEventTypes": {
+ "str": {
+ "dataSchemaUrl": "str",
+ "description": "str",
+ "displayName": "str",
+ "documentationUrl": "str",
+ }
+ },
+ "kind": "str",
+ },
+ "identity": {
+ "principalId": "str",
+ "tenantId": "str",
+ "type": "str",
+ "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}},
+ },
+ "inboundIpRules": [{"action": "str", "ipMask": "str"}],
+ "minimumTlsVersionAllowed": "str",
+ "publicNetworkAccess": "str",
+ "sku": {"name": "Basic"},
+ "tags": {"str": "str"},
+ },
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_topics_list_by_subscription(self, resource_group):
+ response = self.client.topics.list_by_subscription(
+ api_version="2024-12-15-preview",
+ )
+ 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_topics_list_by_resource_group(self, resource_group):
+ response = self.client.topics.list_by_resource_group(
+ resource_group_name=resource_group.name,
+ api_version="2024-12-15-preview",
+ )
+ 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_topics_list_shared_access_keys(self, resource_group):
+ response = await self.client.topics.list_shared_access_keys(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_topics_begin_regenerate_key(self, resource_group):
+ response = await (
+ await self.client.topics.begin_regenerate_key(
+ resource_group_name=resource_group.name,
+ topic_name="str",
+ regenerate_key_request={"keyName": "str"},
+ api_version="2024-12-15-preview",
+ )
+ ).result() # call '.result()' to poll until service return final result
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_topics_list_event_types(self, resource_group):
+ response = self.client.topics.list_event_types(
+ resource_group_name=resource_group.name,
+ provider_namespace="str",
+ resource_type_name="str",
+ resource_name="str",
+ api_version="2024-12-15-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_verified_partners_operations.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_verified_partners_operations.py
new file mode 100644
index 000000000000..7ced786b44fa
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_verified_partners_operations.py
@@ -0,0 +1,40 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementVerifiedPartnersOperations(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_verified_partners_get(self, resource_group):
+ response = self.client.verified_partners.get(
+ verified_partner_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy
+ def test_verified_partners_list(self, resource_group):
+ response = self.client.verified_partners.list(
+ api_version="2024-12-15-preview",
+ )
+ result = [r for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_verified_partners_operations_async.py b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_verified_partners_operations_async.py
new file mode 100644
index 000000000000..bfa556ce671f
--- /dev/null
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/generated_tests/test_event_grid_management_verified_partners_operations_async.py
@@ -0,0 +1,41 @@
+# coding=utf-8
+# --------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# Code generated by Microsoft (R) AutoRest Code Generator.
+# Changes may cause incorrect behavior and will be lost if the code is regenerated.
+# --------------------------------------------------------------------------
+import pytest
+from azure.mgmt.eventgrid.aio import EventGridManagementClient
+
+from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer
+from devtools_testutils.aio import recorded_by_proxy_async
+
+AZURE_LOCATION = "eastus"
+
+
+@pytest.mark.skip("you may need to update the auto-generated test case before run it")
+class TestEventGridManagementVerifiedPartnersOperationsAsync(AzureMgmtRecordedTestCase):
+ def setup_method(self, method):
+ self.client = self.create_mgmt_client(EventGridManagementClient, is_async=True)
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_verified_partners_get(self, resource_group):
+ response = await self.client.verified_partners.get(
+ verified_partner_name="str",
+ api_version="2024-12-15-preview",
+ )
+
+ # please add some check logic here by yourself
+ # ...
+
+ @RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
+ @recorded_by_proxy_async
+ async def test_verified_partners_list(self, resource_group):
+ response = self.client.verified_partners.list(
+ api_version="2024-12-15-preview",
+ )
+ result = [r async for r in response]
+ # please add some check logic here by yourself
+ # ...
diff --git a/sdk/eventgrid/azure-mgmt-eventgrid/setup.py b/sdk/eventgrid/azure-mgmt-eventgrid/setup.py
index 882225833cb5..194f115204c2 100644
--- a/sdk/eventgrid/azure-mgmt-eventgrid/setup.py
+++ b/sdk/eventgrid/azure-mgmt-eventgrid/setup.py
@@ -75,6 +75,7 @@
},
install_requires=[
"isodate>=0.6.1",
+ "typing-extensions>=4.6.0",
"azure-common>=1.1",
"azure-mgmt-core>=1.3.2",
],