diff --git a/sdk/eventgrid/azure-eventgrid/CHANGELOG.md b/sdk/eventgrid/azure-eventgrid/CHANGELOG.md index f5bf39c89947..6f725d30961c 100644 --- a/sdk/eventgrid/azure-eventgrid/CHANGELOG.md +++ b/sdk/eventgrid/azure-eventgrid/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 4.18.1 (Unreleased) +## 4.18.0b1 (Unreleased) ### Features Added diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_model_base.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_model_base.py index 8474b72c2346..f10ebfb873b4 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_model_base.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_model_base.py @@ -5,9 +5,9 @@ # license information. # -------------------------------------------------------------------------- # pylint: disable=protected-access, arguments-differ, signature-differs, broad-except -# pyright: reportGeneralTypeIssues=false import calendar +import decimal import functools import sys import logging @@ -15,9 +15,11 @@ import re import copy import typing -import email +import enum +import email.utils from datetime import datetime, date, time, timedelta, timezone from json import JSONEncoder +from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta @@ -34,6 +36,7 @@ __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") def _timedelta_as_isostr(td: timedelta) -> str: @@ -144,6 +147,8 @@ def default(self, o): # pylint: disable=too-many-return-statements except TypeError: if isinstance(o, _Null): return None + if isinstance(o, decimal.Decimal): + return float(o) if isinstance(o, (bytes, bytearray)): return _serialize_bytes(o, self.format) try: @@ -239,7 +244,7 @@ def _deserialize_date(attr: typing.Union[str, date]) -> date: # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. if isinstance(attr, date): return attr - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore def _deserialize_time(attr: typing.Union[str, time]) -> time: @@ -275,6 +280,12 @@ def _deserialize_duration(attr): return isodate.parse_duration(attr) +def _deserialize_decimal(attr): + if isinstance(attr, decimal.Decimal): + return attr + return decimal.Decimal(str(attr)) + + _DESERIALIZE_MAPPING = { datetime: _deserialize_datetime, date: _deserialize_date, @@ -283,6 +294,7 @@ def _deserialize_duration(attr): bytearray: _deserialize_bytes, timedelta: _deserialize_duration, typing.Any: lambda x: x, + decimal.Decimal: _deserialize_decimal, } _DESERIALIZE_MAPPING_WITHFORMAT = { @@ -373,8 +385,12 @@ def get(self, key: str, default: typing.Any = None) -> typing.Any: except KeyError: return default - @typing.overload # type: ignore - def pop(self, key: str) -> typing.Any: # pylint: disable=no-member + @typing.overload + def pop(self, key: str) -> typing.Any: + ... + + @typing.overload + def pop(self, key: str, default: _T) -> _T: ... @typing.overload @@ -395,8 +411,8 @@ def clear(self) -> None: def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: self._data.update(*args, **kwargs) - @typing.overload # type: ignore - def setdefault(self, key: str) -> typing.Any: + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: ... @typing.overload @@ -434,6 +450,10 @@ def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-m return tuple(_serialize(x, format) for x in o) if isinstance(o, (bytes, bytearray)): return _serialize_bytes(o, format) + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, enum.Enum): + return o.value try: # First try datetime.datetime return _serialize_datetime(o, format) @@ -458,7 +478,13 @@ def _get_rest_field( def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: - return _deserialize(rf._type, value) if (rf and rf._is_model) else _serialize(value, rf._format if rf else None) + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + return _serialize(value, rf._format) class Model(_MyMutableMapping): @@ -494,7 +520,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: def copy(self) -> "Model": return Model(self.__dict__) - def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> "Model": # pylint: disable=unused-argument + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: # pylint: disable=unused-argument # we know the last three classes in mro are going to be 'Model', 'dict', and 'object' mros = cls.__mro__[:-3][::-1] # ignore model, dict, and object parents, and reverse the mro order attr_to_rest_field: typing.Dict[str, _RestField] = { # map attribute name to rest_field property @@ -536,7 +562,7 @@ def _deserialize(cls, data, exist_discriminators): exist_discriminators.append(discriminator) mapped_cls = cls.__mapping__.get( data.get(discriminator), cls - ) # pylint: disable=no-member + ) # pyright: ignore # pylint: disable=no-member if mapped_cls == cls: return cls(data) return mapped_cls._deserialize(data, exist_discriminators) # pylint: disable=protected-access @@ -553,9 +579,14 @@ def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing. if exclude_readonly: readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] for k, v in self.items(): - if exclude_readonly and k in readonly_props: # pyright: ignore[reportUnboundVariable] + if exclude_readonly and k in readonly_props: # pyright: ignore continue - result[k] = Model._as_dict_value(v, exclude_readonly=exclude_readonly) + is_multipart_file_input = False + try: + is_multipart_file_input = next(rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k)._is_multipart_file_input + except StopIteration: + pass + result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) return result @staticmethod @@ -563,10 +594,10 @@ def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: if v is None or isinstance(v, _Null): return None if isinstance(v, (list, tuple, set)): - return [ + return type(v)( Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v - ] + ) if isinstance(v, dict): return { dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) @@ -607,29 +638,22 @@ def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj return obj return _deserialize(model_deserializer, obj) - return functools.partial(_deserialize_model, annotation) + return functools.partial(_deserialize_model, annotation) # pyright: ignore except Exception: pass # is it a literal? try: - if sys.version_info >= (3, 8): - from typing import ( - Literal, - ) # pylint: disable=no-name-in-module, ungrouped-imports - else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - - if annotation.__origin__ == Literal: + if annotation.__origin__ is typing.Literal: # pyright: ignore return None except AttributeError: pass # is it optional? try: - if any(a for a in annotation.__args__ if a == type(None)): + if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore if_obj_deserializer = _get_deserialize_callable_from_annotation( - next(a for a in annotation.__args__ if a != type(None)), module, rf + next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore ) def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): @@ -642,7 +666,13 @@ def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Calla pass if getattr(annotation, "__origin__", None) is typing.Union: - deserializers = [_get_deserialize_callable_from_annotation(arg, module, rf) for arg in annotation.__args__] + # initial ordering is we make `string` the last deserialization option, because it is often them most generic + deserializers = [ + _get_deserialize_callable_from_annotation(arg, module, rf) + for arg in sorted( + annotation.__args__, key=lambda x: hasattr(x, "__name__") and x.__name__ == "str" # pyright: ignore + ) + ] def _deserialize_with_union(deserializers, obj): for deserializer in deserializers: @@ -655,32 +685,31 @@ def _deserialize_with_union(deserializers, obj): return functools.partial(_deserialize_with_union, deserializers) try: - if annotation._name == "Dict": - key_deserializer = _get_deserialize_callable_from_annotation(annotation.__args__[0], module, rf) - value_deserializer = _get_deserialize_callable_from_annotation(annotation.__args__[1], module, rf) + if annotation._name == "Dict": # pyright: ignore + value_deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[1], module, rf # pyright: ignore + ) def _deserialize_dict( - key_deserializer: typing.Optional[typing.Callable], value_deserializer: typing.Optional[typing.Callable], obj: typing.Dict[typing.Any, typing.Any], ): if obj is None: return obj return { - _deserialize(key_deserializer, k, module): _deserialize(value_deserializer, v, module) + k: _deserialize(value_deserializer, v, module) for k, v in obj.items() } return functools.partial( _deserialize_dict, - key_deserializer, value_deserializer, ) except (AttributeError, IndexError): pass try: - if annotation._name in ["List", "Set", "Tuple", "Sequence"]: - if len(annotation.__args__) > 1: + if annotation._name in ["List", "Set", "Tuple", "Sequence"]: # pyright: ignore + if len(annotation.__args__) > 1: # pyright: ignore def _deserialize_multiple_sequence( entry_deserializers: typing.List[typing.Optional[typing.Callable]], @@ -694,10 +723,12 @@ def _deserialize_multiple_sequence( ) entry_deserializers = [ - _get_deserialize_callable_from_annotation(dt, module, rf) for dt in annotation.__args__ + _get_deserialize_callable_from_annotation(dt, module, rf) for dt in annotation.__args__ # pyright: ignore ] return functools.partial(_deserialize_multiple_sequence, entry_deserializers) - deserializer = _get_deserialize_callable_from_annotation(annotation.__args__[0], module, rf) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) def _deserialize_sequence( deserializer: typing.Optional[typing.Callable], @@ -712,19 +743,21 @@ def _deserialize_sequence( pass def _deserialize_default( - annotation, - deserializer_from_mapping, + deserializer, obj, ): if obj is None: return obj try: - return _deserialize_with_callable(annotation, obj) + return _deserialize_with_callable(deserializer, obj) except Exception: pass - return _deserialize_with_callable(deserializer_from_mapping, obj) + return obj - return functools.partial(_deserialize_default, annotation, get_deserializer(annotation, rf)) + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) def _deserialize_with_callable( @@ -732,7 +765,7 @@ def _deserialize_with_callable( value: typing.Any, ): try: - if value is None: + if value is None or isinstance(value, _Null): return None if deserializer is None: return value @@ -760,7 +793,8 @@ def _deserialize( value = value.http_response.json() if rf is None and format: rf = _RestField(format=format) - deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) return _deserialize_with_callable(deserializer, value) @@ -774,6 +808,7 @@ def __init__( visibility: typing.Optional[typing.List[str]] = None, default: typing.Any = _UNSET, format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, ): self._type = type self._rest_name_input = name @@ -783,6 +818,11 @@ def __init__( self._is_model = False self._default = default self._format = format + self._is_multipart_file_input = is_multipart_file_input + + @property + def _class_type(self) -> typing.Any: + return getattr(self._type, "args", [None])[0] @property def _rest_name(self) -> str: @@ -828,8 +868,9 @@ def rest_field( visibility: typing.Optional[typing.List[str]] = None, default: typing.Any = _UNSET, format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, ) -> typing.Any: - return _RestField(name=name, type=type, visibility=visibility, default=default, format=format) + return _RestField(name=name, type=type, visibility=visibility, default=default, format=format, is_multipart_file_input=is_multipart_file_input) def rest_discriminator( diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/_operations.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/_operations.py index 50a506ffb3e5..b38ab06a9492 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/_operations.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -20,6 +20,7 @@ from .. import models as _models from .._model_base import SdkJSONEncoder, _deserialize from .._serialization import Serializer +from .._validation import api_version_validation from .._vendor import EventGridClientMixinABC if sys.version_info >= (3, 9): @@ -312,6 +313,7 @@ def _publish_cloud_event( # pylint: disable=protected-access event: _models._models.CloudEvent, **kwargs: Any ) -> _models._models.PublishResult: + # pylint: disable=line-too-long """Publish Single Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which @@ -322,14 +324,33 @@ def _publish_cloud_event( # pylint: disable=protected-access :type topic_name: str :param event: Single Cloud Event being published. Required. :type event: ~azure.eventgrid.models.CloudEvent - :keyword content_type: content type. Default value is "application/cloudevents+json; - charset=utf-8". - :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: PublishResult. The PublishResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.PublishResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + event = { + "id": "str", # An identifier for the event. The combination of id and source + must be unique for each distinct event. Required. + "source": "str", # Identifies the context in which an event happened. The + combination of id and source must be unique for each distinct event. Required. + "specversion": "str", # The version of the CloudEvents specification which + the event uses. Required. + "type": "str", # Type of event related to the originating occurrence. + Required. + "data": {}, # Optional. Event data specific to the event type. + "data_base64": bytes("bytes", encoding="utf-8"), # Optional. Event data + specific to the event type, encoded as a base64 string. + "datacontenttype": "str", # Optional. Content type of data value. + "dataschema": "str", # Optional. Identifies the schema that data adheres to. + "subject": "str", # Optional. This describes the subject of the event in the + context of the event producer (identified by source). + "time": "2020-02-20 00:00:00" # Optional. The time (in UTC) the event was + generated, in RFC3339 format. + } """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError @@ -344,7 +365,7 @@ def _publish_cloud_event( # pylint: disable=protected-access 'cls', None ) - _content = json.dumps(event, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = event _request = build_event_grid_publish_cloud_event_request( topic_name=topic_name, @@ -396,6 +417,7 @@ def _publish_cloud_events( # pylint: disable=protected-access events: List[_models._models.CloudEvent], **kwargs: Any ) -> _models._models.PublishResult: + # pylint: disable=line-too-long """Publish Batch Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which @@ -406,14 +428,37 @@ def _publish_cloud_events( # pylint: disable=protected-access :type topic_name: str :param events: Array of Cloud Events being published. Required. :type events: list[~azure.eventgrid.models.CloudEvent] - :keyword content_type: content type. Default value is "application/cloudevents-batch+json; - charset=utf-8". - :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: PublishResult. The PublishResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.PublishResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + events = [ + { + "id": "str", # An identifier for the event. The combination of id + and source must be unique for each distinct event. Required. + "source": "str", # Identifies the context in which an event + happened. The combination of id and source must be unique for each distinct + event. Required. + "specversion": "str", # The version of the CloudEvents specification + which the event uses. Required. + "type": "str", # Type of event related to the originating + occurrence. Required. + "data": {}, # Optional. Event data specific to the event type. + "data_base64": bytes("bytes", encoding="utf-8"), # Optional. Event + data specific to the event type, encoded as a base64 string. + "datacontenttype": "str", # Optional. Content type of data value. + "dataschema": "str", # Optional. Identifies the schema that data + adheres to. + "subject": "str", # Optional. This describes the subject of the + event in the context of the event producer (identified by source). + "time": "2020-02-20 00:00:00" # Optional. The time (in UTC) the + event was generated, in RFC3339 format. + } + ] """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError @@ -428,7 +473,7 @@ def _publish_cloud_events( # pylint: disable=protected-access 'cls', None ) - _content = json.dumps(events, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = events _request = build_event_grid_publish_cloud_events_request( topic_name=topic_name, @@ -483,6 +528,7 @@ def _receive_cloud_events( # pylint: disable=protected-access max_wait_time: Optional[int] = None, **kwargs: Any ) -> _models._models.ReceiveResult: + # pylint: disable=line-too-long """Receive Batch of Cloud Events from the Event Subscription. :param topic_name: Topic Name. Required. @@ -498,11 +544,52 @@ def _receive_cloud_events( # pylint: disable=protected-access value is 10 seconds, while maximum value is 120 seconds. If not specified, the default value is 60 seconds. Default value is None. :paramtype max_wait_time: int - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: ReceiveResult. The ReceiveResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.ReceiveResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "value": [ + { + "brokerProperties": { + "deliveryCount": 0, # The attempt count for + delivering the event. Required. + "lockToken": "str" # The token of the lock on the + event. Required. + }, + "event": { + "id": "str", # An identifier for the event. The + combination of id and source must be unique for each distinct event. + Required. + "source": "str", # Identifies the context in which + an event happened. The combination of id and source must be unique + for each distinct event. Required. + "specversion": "str", # The version of the + CloudEvents specification which the event uses. Required. + "type": "str", # Type of event related to the + originating occurrence. Required. + "data": {}, # Optional. Event data specific to the + event type. + "data_base64": bytes("bytes", encoding="utf-8"), # + Optional. Event data specific to the event type, encoded as a base64 + string. + "datacontenttype": "str", # Optional. Content type + of data value. + "dataschema": "str", # Optional. Identifies the + schema that data adheres to. + "subject": "str", # Optional. This describes the + subject of the event in the context of the event producer (identified + by source). + "time": "2020-02-20 00:00:00" # Optional. The time + (in UTC) the event was generated, in RFC3339 format. + } + } + ] + } """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError @@ -585,11 +672,48 @@ def acknowledge_cloud_events( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: AcknowledgeResult. The AcknowledgeResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.AcknowledgeResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + acknowledge_options = { + "lockTokens": [ + "str" # Array of lock tokens. Required. + ] + } + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully acknowledged cloud + events. Required. + ] + } """ @overload @@ -616,11 +740,41 @@ def acknowledge_cloud_events( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: AcknowledgeResult. The AcknowledgeResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.AcknowledgeResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully acknowledged cloud + events. Required. + ] + } """ @overload @@ -628,7 +782,7 @@ def acknowledge_cloud_events( self, topic_name: str, event_subscription_name: str, - acknowledge_options: IO, + acknowledge_options: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -643,15 +797,45 @@ def acknowledge_cloud_events( :param event_subscription_name: Event Subscription Name. Required. :type event_subscription_name: str :param acknowledge_options: AcknowledgeOptions. Required. - :type acknowledge_options: IO + :type acknowledge_options: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: AcknowledgeResult. The AcknowledgeResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.AcknowledgeResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully acknowledged cloud + events. Required. + ] + } """ @@ -660,7 +844,7 @@ def acknowledge_cloud_events( self, topic_name: str, event_subscription_name: str, - acknowledge_options: Union[_models.AcknowledgeOptions, JSON, IO], + acknowledge_options: Union[_models.AcknowledgeOptions, JSON, IO[bytes]], **kwargs: Any ) -> _models.AcknowledgeResult: """Acknowledge batch of Cloud Events. The server responds with an HTTP 200 status code if the @@ -673,16 +857,50 @@ def acknowledge_cloud_events( :param event_subscription_name: Event Subscription Name. Required. :type event_subscription_name: str :param acknowledge_options: AcknowledgeOptions. Is one of the following types: - AcknowledgeOptions, JSON, IO Required. - :type acknowledge_options: ~azure.eventgrid.models.AcknowledgeOptions or JSON or IO - :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default - value is None. - :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. + AcknowledgeOptions, JSON, IO[bytes] Required. + :type acknowledge_options: ~azure.eventgrid.models.AcknowledgeOptions or JSON or IO[bytes] :return: AcknowledgeResult. The AcknowledgeResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.AcknowledgeResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + acknowledge_options = { + "lockTokens": [ + "str" # Array of lock tokens. Required. + ] + } + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully acknowledged cloud + events. Required. + ] + } """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError @@ -749,6 +967,9 @@ def acknowledge_cloud_events( @overload + @api_version_validation( + params_added_on={'2023-10-01-preview': ['release_delay_in_seconds']}, + ) def release_cloud_events( self, topic_name: str, @@ -775,14 +996,54 @@ def release_cloud_events( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: ReleaseResult. The ReleaseResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.ReleaseResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + release_options = { + "lockTokens": [ + "str" # Array of lock tokens. Required. + ] + } + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully released cloud + events. Required. + ] + } """ @overload + @api_version_validation( + params_added_on={'2023-10-01-preview': ['release_delay_in_seconds']}, + ) def release_cloud_events( self, topic_name: str, @@ -809,19 +1070,52 @@ def release_cloud_events( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: ReleaseResult. The ReleaseResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.ReleaseResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully released cloud + events. Required. + ] + } """ @overload + @api_version_validation( + params_added_on={'2023-10-01-preview': ['release_delay_in_seconds']}, + ) def release_cloud_events( self, topic_name: str, event_subscription_name: str, - release_options: IO, + release_options: IO[bytes], *, release_delay_in_seconds: Optional[Union[int, _models.ReleaseDelay]] = None, content_type: str = "application/json", @@ -836,27 +1130,60 @@ def release_cloud_events( :param event_subscription_name: Event Subscription Name. Required. :type event_subscription_name: str :param release_options: ReleaseOptions. Required. - :type release_options: IO + :type release_options: IO[bytes] :keyword release_delay_in_seconds: Release cloud events with the specified delay in seconds. Known values are: 0, 10, 60, 600, and 3600. Default value is None. :paramtype release_delay_in_seconds: int or ~azure.eventgrid.models.ReleaseDelay :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: ReleaseResult. The ReleaseResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.ReleaseResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully released cloud + events. Required. + ] + } """ @distributed_trace + @api_version_validation( + params_added_on={'2023-10-01-preview': ['release_delay_in_seconds']}, + ) def release_cloud_events( self, topic_name: str, event_subscription_name: str, - release_options: Union[_models.ReleaseOptions, JSON, IO], + release_options: Union[_models.ReleaseOptions, JSON, IO[bytes]], *, release_delay_in_seconds: Optional[Union[int, _models.ReleaseDelay]] = None, **kwargs: Any @@ -869,20 +1196,54 @@ def release_cloud_events( :type topic_name: str :param event_subscription_name: Event Subscription Name. Required. :type event_subscription_name: str - :param release_options: ReleaseOptions. Is one of the following types: ReleaseOptions, JSON, IO - Required. - :type release_options: ~azure.eventgrid.models.ReleaseOptions or JSON or IO + :param release_options: ReleaseOptions. Is one of the following types: ReleaseOptions, JSON, + IO[bytes] Required. + :type release_options: ~azure.eventgrid.models.ReleaseOptions or JSON or IO[bytes] :keyword release_delay_in_seconds: Release cloud events with the specified delay in seconds. Known values are: 0, 10, 60, 600, and 3600. Default value is None. :paramtype release_delay_in_seconds: int or ~azure.eventgrid.models.ReleaseDelay - :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default - value is None. - :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: ReleaseResult. The ReleaseResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.ReleaseResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + release_options = { + "lockTokens": [ + "str" # Array of lock tokens. Required. + ] + } + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully released cloud + events. Required. + ] + } """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError @@ -972,11 +1333,48 @@ def reject_cloud_events( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: RejectResult. The RejectResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.RejectResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + reject_options = { + "lockTokens": [ + "str" # Array of lock tokens. Required. + ] + } + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully rejected cloud + events. Required. + ] + } """ @overload @@ -1002,11 +1400,41 @@ def reject_cloud_events( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: RejectResult. The RejectResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.RejectResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully rejected cloud + events. Required. + ] + } """ @overload @@ -1014,7 +1442,7 @@ def reject_cloud_events( self, topic_name: str, event_subscription_name: str, - reject_options: IO, + reject_options: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1028,15 +1456,45 @@ def reject_cloud_events( :param event_subscription_name: Event Subscription Name. Required. :type event_subscription_name: str :param reject_options: RejectOptions. Required. - :type reject_options: IO + :type reject_options: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: RejectResult. The RejectResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.RejectResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully rejected cloud + events. Required. + ] + } """ @@ -1045,7 +1503,7 @@ def reject_cloud_events( self, topic_name: str, event_subscription_name: str, - reject_options: Union[_models.RejectOptions, JSON, IO], + reject_options: Union[_models.RejectOptions, JSON, IO[bytes]], **kwargs: Any ) -> _models.RejectResult: """Reject batch of Cloud Events. The server responds with an HTTP 200 status code if the request @@ -1056,17 +1514,51 @@ def reject_cloud_events( :type topic_name: str :param event_subscription_name: Event Subscription Name. Required. :type event_subscription_name: str - :param reject_options: RejectOptions. Is one of the following types: RejectOptions, JSON, IO - Required. - :type reject_options: ~azure.eventgrid.models.RejectOptions or JSON or IO - :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default - value is None. - :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. + :param reject_options: RejectOptions. Is one of the following types: RejectOptions, JSON, + IO[bytes] Required. + :type reject_options: ~azure.eventgrid.models.RejectOptions or JSON or IO[bytes] :return: RejectResult. The RejectResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.RejectResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + reject_options = { + "lockTokens": [ + "str" # Array of lock tokens. Required. + ] + } + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully rejected cloud + events. Required. + ] + } """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError @@ -1133,6 +1625,9 @@ def reject_cloud_events( @overload + @api_version_validation( + method_added_on="2023-10-01-preview", + ) def renew_cloud_event_locks( self, topic_name: str, @@ -1156,15 +1651,55 @@ def renew_cloud_event_locks( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: RenewCloudEventLocksResult. The RenewCloudEventLocksResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.RenewCloudEventLocksResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + renew_lock_options = { + "lockTokens": [ + "str" # Array of lock tokens. Required. + ] + } + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully renewed locks. + Required. + ] + } """ @overload + @api_version_validation( + method_added_on="2023-10-01-preview", + ) def renew_cloud_event_locks( self, topic_name: str, @@ -1188,20 +1723,53 @@ def renew_cloud_event_locks( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: RenewCloudEventLocksResult. The RenewCloudEventLocksResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.RenewCloudEventLocksResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully renewed locks. + Required. + ] + } """ @overload + @api_version_validation( + method_added_on="2023-10-01-preview", + ) def renew_cloud_event_locks( self, topic_name: str, event_subscription_name: str, - renew_lock_options: IO, + renew_lock_options: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1216,25 +1784,58 @@ def renew_cloud_event_locks( :param event_subscription_name: Event Subscription Name. Required. :type event_subscription_name: str :param renew_lock_options: RenewLockOptions. Required. - :type renew_lock_options: IO + :type renew_lock_options: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: RenewCloudEventLocksResult. The RenewCloudEventLocksResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.RenewCloudEventLocksResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully renewed locks. + Required. + ] + } """ @distributed_trace + @api_version_validation( + method_added_on="2023-10-01-preview", + ) def renew_cloud_event_locks( self, topic_name: str, event_subscription_name: str, - renew_lock_options: Union[_models.RenewLockOptions, JSON, IO], + renew_lock_options: Union[_models.RenewLockOptions, JSON, IO[bytes]], **kwargs: Any ) -> _models.RenewCloudEventLocksResult: """Renew lock for batch of Cloud Events. The server responds with an HTTP 200 status code if the @@ -1247,17 +1848,51 @@ def renew_cloud_event_locks( :param event_subscription_name: Event Subscription Name. Required. :type event_subscription_name: str :param renew_lock_options: RenewLockOptions. Is one of the following types: RenewLockOptions, - JSON, IO Required. - :type renew_lock_options: ~azure.eventgrid.models.RenewLockOptions or JSON or IO - :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default - value is None. - :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. + JSON, IO[bytes] Required. + :type renew_lock_options: ~azure.eventgrid.models.RenewLockOptions or JSON or IO[bytes] :return: RenewCloudEventLocksResult. The RenewCloudEventLocksResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.RenewCloudEventLocksResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + renew_lock_options = { + "lockTokens": [ + "str" # Array of lock tokens. Required. + ] + } + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully renewed locks. + Required. + ] + } """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_serialization.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_serialization.py index c33dabefd203..75e26c415d2c 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_serialization.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_serialization.py @@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -547,7 +540,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): + def __init__(self, classes: Optional[Mapping[str, type]]=None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -563,7 +556,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -651,7 +644,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -747,7 +740,7 @@ def query(self, name, data, data_type, **kwargs): :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 + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -1000,7 +993,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1376,7 +1369,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): + def __init__(self, classes: Optional[Mapping[str, type]]=None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1396,7 +1389,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]]=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1449,7 +1442,7 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) @@ -1520,14 +1513,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1583,7 +1576,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1705,7 +1698,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1762,7 +1755,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1866,7 +1859,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise DeserializationError(msg) from err @@ -2002,6 +1995,7 @@ def deserialize_unix(attr): if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_validation.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_validation.py new file mode 100644 index 000000000000..102dea177140 --- /dev/null +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_validation.py @@ -0,0 +1,43 @@ +# -------------------------------------------------------------------------- +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools + +def api_version_validation(**kwargs): + params_added_on = kwargs.pop("params_added_on", {}) + method_added_on = kwargs.pop("method_added_on", "") + + def decorator(func): + @functools.wraps(func) + def wrapper(*args, **kwargs): + try: + # this assumes the client has an _api_version attribute + client = args[0] + client_api_version = client._config.api_version # pylint: disable=protected-access + except AttributeError: + return func(*args, **kwargs) + + if method_added_on > client_api_version: + raise ValueError( + f"'{func.__name__}' is not available in API version " + f"{client_api_version}. Pass service API version {method_added_on} or newer to your client." + ) + + unsupported = { + parameter: api_version + for api_version, parameters in params_added_on.items() + for parameter in parameters + if parameter in kwargs and api_version > client_api_version + } + if unsupported: + raise ValueError("".join([ + f"'{param}' is not available in API version {client_api_version}. " + f"Use service API version {version} or newer.\n" + for param, version in unsupported.items() + ])) + return func(*args, **kwargs) + return wrapper + return decorator diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_version.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_version.py index 52beb0595f5b..6b36742fd015 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_version.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.18.1" +VERSION = "4.18.0b1" diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/_operations.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/_operations.py index aab392f5cf99..5583df5b4b9e 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/_operations.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -20,6 +20,7 @@ from ... import models as _models from ..._model_base import SdkJSONEncoder, _deserialize from ..._operations._operations import build_event_grid_acknowledge_cloud_events_request, build_event_grid_publish_cloud_event_request, build_event_grid_publish_cloud_events_request, build_event_grid_receive_cloud_events_request, build_event_grid_reject_cloud_events_request, build_event_grid_release_cloud_events_request, build_event_grid_renew_cloud_event_locks_request +from ..._validation import api_version_validation from .._vendor import EventGridClientMixinABC if sys.version_info >= (3, 9): @@ -41,6 +42,7 @@ async def _publish_cloud_event( # pylint: disable=protected-access event: _models._models.CloudEvent, **kwargs: Any ) -> _models._models.PublishResult: + # pylint: disable=line-too-long """Publish Single Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which @@ -51,14 +53,33 @@ async def _publish_cloud_event( # pylint: disable=protected-access :type topic_name: str :param event: Single Cloud Event being published. Required. :type event: ~azure.eventgrid.models.CloudEvent - :keyword content_type: content type. Default value is "application/cloudevents+json; - charset=utf-8". - :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: PublishResult. The PublishResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.PublishResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + event = { + "id": "str", # An identifier for the event. The combination of id and source + must be unique for each distinct event. Required. + "source": "str", # Identifies the context in which an event happened. The + combination of id and source must be unique for each distinct event. Required. + "specversion": "str", # The version of the CloudEvents specification which + the event uses. Required. + "type": "str", # Type of event related to the originating occurrence. + Required. + "data": {}, # Optional. Event data specific to the event type. + "data_base64": bytes("bytes", encoding="utf-8"), # Optional. Event data + specific to the event type, encoded as a base64 string. + "datacontenttype": "str", # Optional. Content type of data value. + "dataschema": "str", # Optional. Identifies the schema that data adheres to. + "subject": "str", # Optional. This describes the subject of the event in the + context of the event producer (identified by source). + "time": "2020-02-20 00:00:00" # Optional. The time (in UTC) the event was + generated, in RFC3339 format. + } """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError @@ -73,7 +94,7 @@ async def _publish_cloud_event( # pylint: disable=protected-access 'cls', None ) - _content = json.dumps(event, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = event _request = build_event_grid_publish_cloud_event_request( topic_name=topic_name, @@ -125,6 +146,7 @@ async def _publish_cloud_events( # pylint: disable=protected-access events: List[_models._models.CloudEvent], **kwargs: Any ) -> _models._models.PublishResult: + # pylint: disable=line-too-long """Publish Batch Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which @@ -135,14 +157,37 @@ async def _publish_cloud_events( # pylint: disable=protected-access :type topic_name: str :param events: Array of Cloud Events being published. Required. :type events: list[~azure.eventgrid.models.CloudEvent] - :keyword content_type: content type. Default value is "application/cloudevents-batch+json; - charset=utf-8". - :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: PublishResult. The PublishResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.PublishResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + events = [ + { + "id": "str", # An identifier for the event. The combination of id + and source must be unique for each distinct event. Required. + "source": "str", # Identifies the context in which an event + happened. The combination of id and source must be unique for each distinct + event. Required. + "specversion": "str", # The version of the CloudEvents specification + which the event uses. Required. + "type": "str", # Type of event related to the originating + occurrence. Required. + "data": {}, # Optional. Event data specific to the event type. + "data_base64": bytes("bytes", encoding="utf-8"), # Optional. Event + data specific to the event type, encoded as a base64 string. + "datacontenttype": "str", # Optional. Content type of data value. + "dataschema": "str", # Optional. Identifies the schema that data + adheres to. + "subject": "str", # Optional. This describes the subject of the + event in the context of the event producer (identified by source). + "time": "2020-02-20 00:00:00" # Optional. The time (in UTC) the + event was generated, in RFC3339 format. + } + ] """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError @@ -157,7 +202,7 @@ async def _publish_cloud_events( # pylint: disable=protected-access 'cls', None ) - _content = json.dumps(events, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = events _request = build_event_grid_publish_cloud_events_request( topic_name=topic_name, @@ -212,6 +257,7 @@ async def _receive_cloud_events( # pylint: disable=protected-access max_wait_time: Optional[int] = None, **kwargs: Any ) -> _models._models.ReceiveResult: + # pylint: disable=line-too-long """Receive Batch of Cloud Events from the Event Subscription. :param topic_name: Topic Name. Required. @@ -227,11 +273,52 @@ async def _receive_cloud_events( # pylint: disable=protected-access value is 10 seconds, while maximum value is 120 seconds. If not specified, the default value is 60 seconds. Default value is None. :paramtype max_wait_time: int - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: ReceiveResult. The ReceiveResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.ReceiveResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "value": [ + { + "brokerProperties": { + "deliveryCount": 0, # The attempt count for + delivering the event. Required. + "lockToken": "str" # The token of the lock on the + event. Required. + }, + "event": { + "id": "str", # An identifier for the event. The + combination of id and source must be unique for each distinct event. + Required. + "source": "str", # Identifies the context in which + an event happened. The combination of id and source must be unique + for each distinct event. Required. + "specversion": "str", # The version of the + CloudEvents specification which the event uses. Required. + "type": "str", # Type of event related to the + originating occurrence. Required. + "data": {}, # Optional. Event data specific to the + event type. + "data_base64": bytes("bytes", encoding="utf-8"), # + Optional. Event data specific to the event type, encoded as a base64 + string. + "datacontenttype": "str", # Optional. Content type + of data value. + "dataschema": "str", # Optional. Identifies the + schema that data adheres to. + "subject": "str", # Optional. This describes the + subject of the event in the context of the event producer (identified + by source). + "time": "2020-02-20 00:00:00" # Optional. The time + (in UTC) the event was generated, in RFC3339 format. + } + } + ] + } """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError @@ -314,11 +401,48 @@ async def acknowledge_cloud_events( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: AcknowledgeResult. The AcknowledgeResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.AcknowledgeResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + acknowledge_options = { + "lockTokens": [ + "str" # Array of lock tokens. Required. + ] + } + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully acknowledged cloud + events. Required. + ] + } """ @overload @@ -345,11 +469,41 @@ async def acknowledge_cloud_events( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: AcknowledgeResult. The AcknowledgeResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.AcknowledgeResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully acknowledged cloud + events. Required. + ] + } """ @overload @@ -357,7 +511,7 @@ async def acknowledge_cloud_events( self, topic_name: str, event_subscription_name: str, - acknowledge_options: IO, + acknowledge_options: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -372,15 +526,45 @@ async def acknowledge_cloud_events( :param event_subscription_name: Event Subscription Name. Required. :type event_subscription_name: str :param acknowledge_options: AcknowledgeOptions. Required. - :type acknowledge_options: IO + :type acknowledge_options: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: AcknowledgeResult. The AcknowledgeResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.AcknowledgeResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully acknowledged cloud + events. Required. + ] + } """ @@ -389,7 +573,7 @@ async def acknowledge_cloud_events( self, topic_name: str, event_subscription_name: str, - acknowledge_options: Union[_models.AcknowledgeOptions, JSON, IO], + acknowledge_options: Union[_models.AcknowledgeOptions, JSON, IO[bytes]], **kwargs: Any ) -> _models.AcknowledgeResult: """Acknowledge batch of Cloud Events. The server responds with an HTTP 200 status code if the @@ -402,16 +586,50 @@ async def acknowledge_cloud_events( :param event_subscription_name: Event Subscription Name. Required. :type event_subscription_name: str :param acknowledge_options: AcknowledgeOptions. Is one of the following types: - AcknowledgeOptions, JSON, IO Required. - :type acknowledge_options: ~azure.eventgrid.models.AcknowledgeOptions or JSON or IO - :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default - value is None. - :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. + AcknowledgeOptions, JSON, IO[bytes] Required. + :type acknowledge_options: ~azure.eventgrid.models.AcknowledgeOptions or JSON or IO[bytes] :return: AcknowledgeResult. The AcknowledgeResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.AcknowledgeResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + acknowledge_options = { + "lockTokens": [ + "str" # Array of lock tokens. Required. + ] + } + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully acknowledged cloud + events. Required. + ] + } """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError @@ -478,6 +696,9 @@ async def acknowledge_cloud_events( @overload + @api_version_validation( + params_added_on={'2023-10-01-preview': ['release_delay_in_seconds']}, + ) async def release_cloud_events( self, topic_name: str, @@ -504,14 +725,54 @@ async def release_cloud_events( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: ReleaseResult. The ReleaseResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.ReleaseResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + release_options = { + "lockTokens": [ + "str" # Array of lock tokens. Required. + ] + } + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully released cloud + events. Required. + ] + } """ @overload + @api_version_validation( + params_added_on={'2023-10-01-preview': ['release_delay_in_seconds']}, + ) async def release_cloud_events( self, topic_name: str, @@ -538,19 +799,52 @@ async def release_cloud_events( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: ReleaseResult. The ReleaseResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.ReleaseResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully released cloud + events. Required. + ] + } """ @overload + @api_version_validation( + params_added_on={'2023-10-01-preview': ['release_delay_in_seconds']}, + ) async def release_cloud_events( self, topic_name: str, event_subscription_name: str, - release_options: IO, + release_options: IO[bytes], *, release_delay_in_seconds: Optional[Union[int, _models.ReleaseDelay]] = None, content_type: str = "application/json", @@ -565,27 +859,60 @@ async def release_cloud_events( :param event_subscription_name: Event Subscription Name. Required. :type event_subscription_name: str :param release_options: ReleaseOptions. Required. - :type release_options: IO + :type release_options: IO[bytes] :keyword release_delay_in_seconds: Release cloud events with the specified delay in seconds. Known values are: 0, 10, 60, 600, and 3600. Default value is None. :paramtype release_delay_in_seconds: int or ~azure.eventgrid.models.ReleaseDelay :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: ReleaseResult. The ReleaseResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.ReleaseResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully released cloud + events. Required. + ] + } """ @distributed_trace_async + @api_version_validation( + params_added_on={'2023-10-01-preview': ['release_delay_in_seconds']}, + ) async def release_cloud_events( self, topic_name: str, event_subscription_name: str, - release_options: Union[_models.ReleaseOptions, JSON, IO], + release_options: Union[_models.ReleaseOptions, JSON, IO[bytes]], *, release_delay_in_seconds: Optional[Union[int, _models.ReleaseDelay]] = None, **kwargs: Any @@ -598,20 +925,54 @@ async def release_cloud_events( :type topic_name: str :param event_subscription_name: Event Subscription Name. Required. :type event_subscription_name: str - :param release_options: ReleaseOptions. Is one of the following types: ReleaseOptions, JSON, IO - Required. - :type release_options: ~azure.eventgrid.models.ReleaseOptions or JSON or IO + :param release_options: ReleaseOptions. Is one of the following types: ReleaseOptions, JSON, + IO[bytes] Required. + :type release_options: ~azure.eventgrid.models.ReleaseOptions or JSON or IO[bytes] :keyword release_delay_in_seconds: Release cloud events with the specified delay in seconds. Known values are: 0, 10, 60, 600, and 3600. Default value is None. :paramtype release_delay_in_seconds: int or ~azure.eventgrid.models.ReleaseDelay - :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default - value is None. - :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: ReleaseResult. The ReleaseResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.ReleaseResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + release_options = { + "lockTokens": [ + "str" # Array of lock tokens. Required. + ] + } + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully released cloud + events. Required. + ] + } """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError @@ -701,11 +1062,48 @@ async def reject_cloud_events( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: RejectResult. The RejectResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.RejectResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + reject_options = { + "lockTokens": [ + "str" # Array of lock tokens. Required. + ] + } + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully rejected cloud + events. Required. + ] + } """ @overload @@ -731,11 +1129,41 @@ async def reject_cloud_events( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: RejectResult. The RejectResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.RejectResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully rejected cloud + events. Required. + ] + } """ @overload @@ -743,7 +1171,7 @@ async def reject_cloud_events( self, topic_name: str, event_subscription_name: str, - reject_options: IO, + reject_options: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -757,15 +1185,45 @@ async def reject_cloud_events( :param event_subscription_name: Event Subscription Name. Required. :type event_subscription_name: str :param reject_options: RejectOptions. Required. - :type reject_options: IO + :type reject_options: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: RejectResult. The RejectResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.RejectResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully rejected cloud + events. Required. + ] + } """ @@ -774,7 +1232,7 @@ async def reject_cloud_events( self, topic_name: str, event_subscription_name: str, - reject_options: Union[_models.RejectOptions, JSON, IO], + reject_options: Union[_models.RejectOptions, JSON, IO[bytes]], **kwargs: Any ) -> _models.RejectResult: """Reject batch of Cloud Events. The server responds with an HTTP 200 status code if the request @@ -785,17 +1243,51 @@ async def reject_cloud_events( :type topic_name: str :param event_subscription_name: Event Subscription Name. Required. :type event_subscription_name: str - :param reject_options: RejectOptions. Is one of the following types: RejectOptions, JSON, IO - Required. - :type reject_options: ~azure.eventgrid.models.RejectOptions or JSON or IO - :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default - value is None. - :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. + :param reject_options: RejectOptions. Is one of the following types: RejectOptions, JSON, + IO[bytes] Required. + :type reject_options: ~azure.eventgrid.models.RejectOptions or JSON or IO[bytes] :return: RejectResult. The RejectResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.RejectResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + reject_options = { + "lockTokens": [ + "str" # Array of lock tokens. Required. + ] + } + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully rejected cloud + events. Required. + ] + } """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError @@ -862,6 +1354,9 @@ async def reject_cloud_events( @overload + @api_version_validation( + method_added_on="2023-10-01-preview", + ) async def renew_cloud_event_locks( self, topic_name: str, @@ -885,15 +1380,55 @@ async def renew_cloud_event_locks( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: RenewCloudEventLocksResult. The RenewCloudEventLocksResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.RenewCloudEventLocksResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + renew_lock_options = { + "lockTokens": [ + "str" # Array of lock tokens. Required. + ] + } + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully renewed locks. + Required. + ] + } """ @overload + @api_version_validation( + method_added_on="2023-10-01-preview", + ) async def renew_cloud_event_locks( self, topic_name: str, @@ -917,20 +1452,53 @@ async def renew_cloud_event_locks( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: RenewCloudEventLocksResult. The RenewCloudEventLocksResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.RenewCloudEventLocksResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully renewed locks. + Required. + ] + } """ @overload + @api_version_validation( + method_added_on="2023-10-01-preview", + ) async def renew_cloud_event_locks( self, topic_name: str, event_subscription_name: str, - renew_lock_options: IO, + renew_lock_options: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -945,25 +1513,58 @@ async def renew_cloud_event_locks( :param event_subscription_name: Event Subscription Name. Required. :type event_subscription_name: str :param renew_lock_options: RenewLockOptions. Required. - :type renew_lock_options: IO + :type renew_lock_options: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. :return: RenewCloudEventLocksResult. The RenewCloudEventLocksResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.RenewCloudEventLocksResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully renewed locks. + Required. + ] + } """ @distributed_trace_async + @api_version_validation( + method_added_on="2023-10-01-preview", + ) async def renew_cloud_event_locks( self, topic_name: str, event_subscription_name: str, - renew_lock_options: Union[_models.RenewLockOptions, JSON, IO], + renew_lock_options: Union[_models.RenewLockOptions, JSON, IO[bytes]], **kwargs: Any ) -> _models.RenewCloudEventLocksResult: """Renew lock for batch of Cloud Events. The server responds with an HTTP 200 status code if the @@ -976,17 +1577,51 @@ async def renew_cloud_event_locks( :param event_subscription_name: Event Subscription Name. Required. :type event_subscription_name: str :param renew_lock_options: RenewLockOptions. Is one of the following types: RenewLockOptions, - JSON, IO Required. - :type renew_lock_options: ~azure.eventgrid.models.RenewLockOptions or JSON or IO - :keyword content_type: Body parameter Content-Type. Known values are: application/json. Default - value is None. - :paramtype content_type: str - :keyword bool stream: Whether to stream the response of this operation. Defaults to False. You - will have to context manage the returned stream. + JSON, IO[bytes] Required. + :type renew_lock_options: ~azure.eventgrid.models.RenewLockOptions or JSON or IO[bytes] :return: RenewCloudEventLocksResult. The RenewCloudEventLocksResult is compatible with MutableMapping :rtype: ~azure.eventgrid.models.RenewCloudEventLocksResult :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + renew_lock_options = { + "lockTokens": [ + "str" # Array of lock tokens. Required. + ] + } + + # response body for status code(s): 200 + response == { + "failedLockTokens": [ + { + "error": { + "code": "str", # One of a server-defined set of + error codes. Required. + "message": "str", # A human-readable representation + of the error. Required. + "details": [ + ... + ], + "innererror": { + "code": "str", # Optional. One of a + server-defined set of error codes. + "innererror": ... + }, + "target": "str" # Optional. The target of the error. + }, + "lockToken": "str" # The lock token of an entry in the + request. Required. + } + ], + "succeededLockTokens": [ + "str" # Array of lock tokens for the successfully renewed locks. + Required. + ] + } """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/_models.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/_models.py index 588b90e04c7d..a9bcc960fafc 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/_models.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/_models.py @@ -30,6 +30,7 @@ class AcknowledgeOptions(_model_base.Model): lock_tokens: List[str] = rest_field(name="lockTokens") """Array of lock tokens. Required.""" + @overload def __init__( self, @@ -47,6 +48,8 @@ def __init__(self, mapping: Mapping[str, Any]): def __init__(self, *args: Any, **kwargs: Any) -> None:# pylint: disable=useless-super-delegation super().__init__(*args, **kwargs) + + class AcknowledgeResult(_model_base.Model): @@ -69,6 +72,7 @@ class AcknowledgeResult(_model_base.Model): succeeded_lock_tokens: List[str] = rest_field(name="succeededLockTokens") """Array of lock tokens for the successfully acknowledged cloud events. Required.""" + @overload def __init__( self, @@ -87,6 +91,8 @@ def __init__(self, mapping: Mapping[str, Any]): def __init__(self, *args: Any, **kwargs: Any) -> None:# pylint: disable=useless-super-delegation super().__init__(*args, **kwargs) + + class BrokerProperties(_model_base.Model): @@ -106,6 +112,8 @@ class BrokerProperties(_model_base.Model): """The attempt count for delivering the event. Required.""" + + class CloudEvent(_model_base.Model): """Properties of an event published to an Azure Messaging EventGrid Namespace topic using the @@ -163,6 +171,8 @@ class CloudEvent(_model_base.Model): source).""" + + class Error(_model_base.Model): """The error object. @@ -193,6 +203,7 @@ class Error(_model_base.Model): innererror: Optional["_models.InnerError"] = rest_field() """An object containing more specific information than the current object about the error.""" + @overload def __init__( self, @@ -214,6 +225,8 @@ def __init__(self, mapping: Mapping[str, Any]): def __init__(self, *args: Any, **kwargs: Any) -> None:# pylint: disable=useless-super-delegation super().__init__(*args, **kwargs) + + class FailedLockToken(_model_base.Model): @@ -233,6 +246,7 @@ class FailedLockToken(_model_base.Model): error: "_models.Error" = rest_field() """Error information of the failed operation result for the lock token in the request. Required.""" + @overload def __init__( self, @@ -251,6 +265,8 @@ def __init__(self, mapping: Mapping[str, Any]): def __init__(self, *args: Any, **kwargs: Any) -> None:# pylint: disable=useless-super-delegation super().__init__(*args, **kwargs) + + class InnerError(_model_base.Model): @@ -269,6 +285,7 @@ class InnerError(_model_base.Model): innererror: Optional["_models.InnerError"] = rest_field() """Inner error.""" + @overload def __init__( self, @@ -287,6 +304,8 @@ def __init__(self, mapping: Mapping[str, Any]): def __init__(self, *args: Any, **kwargs: Any) -> None:# pylint: disable=useless-super-delegation super().__init__(*args, **kwargs) + + class PublishResult(_model_base.Model): @@ -296,6 +315,8 @@ class PublishResult(_model_base.Model): + + class ReceiveDetails(_model_base.Model): """Receive operation details per Cloud Event. @@ -314,6 +335,8 @@ class ReceiveDetails(_model_base.Model): """Cloud Event details. Required.""" + + class ReceiveResult(_model_base.Model): """Details of the Receive operation response. @@ -328,6 +351,8 @@ class ReceiveResult(_model_base.Model): """Array of receive responses, one per cloud event. Required.""" + + class RejectOptions(_model_base.Model): """Array of lock tokens for the corresponding received Cloud Events to be rejected. @@ -341,6 +366,7 @@ class RejectOptions(_model_base.Model): lock_tokens: List[str] = rest_field(name="lockTokens") """Array of lock tokens. Required.""" + @overload def __init__( self, @@ -358,6 +384,8 @@ def __init__(self, mapping: Mapping[str, Any]): def __init__(self, *args: Any, **kwargs: Any) -> None:# pylint: disable=useless-super-delegation super().__init__(*args, **kwargs) + + class RejectResult(_model_base.Model): @@ -380,6 +408,7 @@ class RejectResult(_model_base.Model): succeeded_lock_tokens: List[str] = rest_field(name="succeededLockTokens") """Array of lock tokens for the successfully rejected cloud events. Required.""" + @overload def __init__( self, @@ -398,6 +427,8 @@ def __init__(self, mapping: Mapping[str, Any]): def __init__(self, *args: Any, **kwargs: Any) -> None:# pylint: disable=useless-super-delegation super().__init__(*args, **kwargs) + + class ReleaseOptions(_model_base.Model): @@ -412,6 +443,7 @@ class ReleaseOptions(_model_base.Model): lock_tokens: List[str] = rest_field(name="lockTokens") """Array of lock tokens. Required.""" + @overload def __init__( self, @@ -429,6 +461,8 @@ def __init__(self, mapping: Mapping[str, Any]): def __init__(self, *args: Any, **kwargs: Any) -> None:# pylint: disable=useless-super-delegation super().__init__(*args, **kwargs) + + class ReleaseResult(_model_base.Model): @@ -451,6 +485,7 @@ class ReleaseResult(_model_base.Model): succeeded_lock_tokens: List[str] = rest_field(name="succeededLockTokens") """Array of lock tokens for the successfully released cloud events. Required.""" + @overload def __init__( self, @@ -469,6 +504,8 @@ def __init__(self, mapping: Mapping[str, Any]): def __init__(self, *args: Any, **kwargs: Any) -> None:# pylint: disable=useless-super-delegation super().__init__(*args, **kwargs) + + class RenewCloudEventLocksResult(_model_base.Model): @@ -490,6 +527,7 @@ class RenewCloudEventLocksResult(_model_base.Model): succeeded_lock_tokens: List[str] = rest_field(name="succeededLockTokens") """Array of lock tokens for the successfully renewed locks. Required.""" + @overload def __init__( self, @@ -508,6 +546,8 @@ def __init__(self, mapping: Mapping[str, Any]): def __init__(self, *args: Any, **kwargs: Any) -> None:# pylint: disable=useless-super-delegation super().__init__(*args, **kwargs) + + class RenewLockOptions(_model_base.Model): @@ -522,6 +562,7 @@ class RenewLockOptions(_model_base.Model): lock_tokens: List[str] = rest_field(name="lockTokens") """Array of lock tokens. Required.""" + @overload def __init__( self, @@ -539,3 +580,5 @@ def __init__(self, mapping: Mapping[str, Any]): def __init__(self, *args: Any, **kwargs: Any) -> None:# pylint: disable=useless-super-delegation super().__init__(*args, **kwargs) + + diff --git a/sdk/eventgrid/azure-eventgrid/pyproject.toml b/sdk/eventgrid/azure-eventgrid/pyproject.toml index fdde94224048..5f3098c4c74b 100644 --- a/sdk/eventgrid/azure-eventgrid/pyproject.toml +++ b/sdk/eventgrid/azure-eventgrid/pyproject.toml @@ -2,4 +2,5 @@ pyright = false type_check_samples = false verifytypes = false -strict_sphinx = true +strict_sphinx = false +pylint = false \ No newline at end of file diff --git a/sdk/eventgrid/azure-eventgrid/setup.py b/sdk/eventgrid/azure-eventgrid/setup.py index adf215e92d0e..ad121db2982c 100644 --- a/sdk/eventgrid/azure-eventgrid/setup.py +++ b/sdk/eventgrid/azure-eventgrid/setup.py @@ -38,18 +38,17 @@ url="https://github.com/Azure/azure-sdk-for-python/tree/main/sdk", keywords="azure, azure sdk", classifiers=[ - "Development Status :: 5 - Production/Stable", - 'Programming Language :: Python', - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'Programming Language :: Python :: 3.12', - 'License :: OSI Approved :: MIT License', + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "License :: OSI Approved :: MIT License", ], - python_requires=">=3.8", zip_safe=False, packages=find_packages( exclude=[ @@ -63,8 +62,9 @@ "azure.eventgrid": ["py.typed"], }, install_requires=[ - "isodate>=0.6.1", - 'azure-core>=1.24.0', + "isodate<1.0.0,>=0.6.1", + "azure-core<2.0.0,>=1.30.0", + "typing-extensions>=4.6.0", ], - python_requires=">=3.7", + python_requires=">=3.8", ) diff --git a/sdk/eventgrid/azure-eventgrid/tsp-location.yaml b/sdk/eventgrid/azure-eventgrid/tsp-location.yaml index e5a84555e08a..3f8ef6b354e8 100644 --- a/sdk/eventgrid/azure-eventgrid/tsp-location.yaml +++ b/sdk/eventgrid/azure-eventgrid/tsp-location.yaml @@ -1,4 +1,4 @@ cleanup: false -commit: 116c17a841a9b37a3fce426558099b5ad5fe16de +commit: f56fd0ca360a8545e4a9e108b84abf01ba195d2d directory: specification/eventgrid/Azure.Messaging.EventGrid repo: Azure/azure-rest-api-specs \ No newline at end of file