diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/_operations.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/_operations.py index 8acea71f7930..ddc792b50d08 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/_operations.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/_operations.py @@ -649,18 +649,18 @@ def _receive_cloud_events( # pylint: disable=protected-access @overload - def _acknowledge_cloud_events( + def _acknowledge_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, - acknowledge_options: _models.AcknowledgeOptions, + acknowledge_options: _models._models.AcknowledgeOptions, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AcknowledgeResult: + ) -> _models._models.AcknowledgeResult: ... @overload - def _acknowledge_cloud_events( + def _acknowledge_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, @@ -668,10 +668,10 @@ def _acknowledge_cloud_events( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AcknowledgeResult: + ) -> _models._models.AcknowledgeResult: ... @overload - def _acknowledge_cloud_events( + def _acknowledge_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, @@ -679,17 +679,17 @@ def _acknowledge_cloud_events( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AcknowledgeResult: + ) -> _models._models.AcknowledgeResult: ... @distributed_trace - def _acknowledge_cloud_events( + def _acknowledge_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, - acknowledge_options: Union[_models.AcknowledgeOptions, JSON, IO[bytes]], + acknowledge_options: Union[_models._models.AcknowledgeOptions, JSON, IO[bytes]], **kwargs: Any - ) -> _models.AcknowledgeResult: + ) -> _models._models.AcknowledgeResult: """Acknowledge batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully acknowledged lockTokens, along with other failed lockTokens with their corresponding error @@ -754,7 +754,7 @@ def _acknowledge_cloud_events( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop('content_type', _headers.pop('Content-Type', None)) - cls: ClsType[_models.AcknowledgeResult] = kwargs.pop( + cls: ClsType[_models._models.AcknowledgeResult] = kwargs.pop( # pylint: disable=protected-access 'cls', None ) @@ -798,7 +798,7 @@ def _acknowledge_cloud_events( deserialized = response.iter_bytes() else: deserialized = _deserialize( - _models.AcknowledgeResult, + _models._models.AcknowledgeResult, # pylint: disable=protected-access response.json() ) @@ -812,23 +812,23 @@ def _acknowledge_cloud_events( @overload @api_version_validation( params_added_on={'2023-10-01-preview': ['release_delay_in_seconds']}, - ) - def _release_cloud_events( + ) # pylint: disable=protected-access + def _release_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, - release_options: _models.ReleaseOptions, + release_options: _models._models.ReleaseOptions, *, release_delay_in_seconds: Optional[Union[int, _models.ReleaseDelay]] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.ReleaseResult: + ) -> _models._models.ReleaseResult: ... @overload @api_version_validation( params_added_on={'2023-10-01-preview': ['release_delay_in_seconds']}, - ) - def _release_cloud_events( + ) # pylint: disable=protected-access + def _release_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, @@ -837,13 +837,13 @@ def _release_cloud_events( release_delay_in_seconds: Optional[Union[int, _models.ReleaseDelay]] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.ReleaseResult: + ) -> _models._models.ReleaseResult: ... @overload @api_version_validation( params_added_on={'2023-10-01-preview': ['release_delay_in_seconds']}, - ) - def _release_cloud_events( + ) # pylint: disable=protected-access + def _release_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, @@ -852,22 +852,22 @@ def _release_cloud_events( release_delay_in_seconds: Optional[Union[int, _models.ReleaseDelay]] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.ReleaseResult: + ) -> _models._models.ReleaseResult: ... @distributed_trace @api_version_validation( params_added_on={'2023-10-01-preview': ['release_delay_in_seconds']}, - ) - def _release_cloud_events( + ) # pylint: disable=protected-access + def _release_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, - release_options: Union[_models.ReleaseOptions, JSON, IO[bytes]], + release_options: Union[_models._models.ReleaseOptions, JSON, IO[bytes]], *, release_delay_in_seconds: Optional[Union[int, _models.ReleaseDelay]] = None, **kwargs: Any - ) -> _models.ReleaseResult: + ) -> _models._models.ReleaseResult: """Release batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully released lockTokens, along with other failed lockTokens with their corresponding error information. @@ -934,7 +934,7 @@ def _release_cloud_events( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop('content_type', _headers.pop('Content-Type', None)) - cls: ClsType[_models.ReleaseResult] = kwargs.pop( + cls: ClsType[_models._models.ReleaseResult] = kwargs.pop( # pylint: disable=protected-access 'cls', None ) @@ -979,7 +979,7 @@ def _release_cloud_events( deserialized = response.iter_bytes() else: deserialized = _deserialize( - _models.ReleaseResult, + _models._models.ReleaseResult, # pylint: disable=protected-access response.json() ) @@ -991,18 +991,18 @@ def _release_cloud_events( @overload - def _reject_cloud_events( + def _reject_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, - reject_options: _models.RejectOptions, + reject_options: _models._models.RejectOptions, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RejectResult: + ) -> _models._models.RejectResult: ... @overload - def _reject_cloud_events( + def _reject_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, @@ -1010,10 +1010,10 @@ def _reject_cloud_events( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RejectResult: + ) -> _models._models.RejectResult: ... @overload - def _reject_cloud_events( + def _reject_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, @@ -1021,17 +1021,17 @@ def _reject_cloud_events( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RejectResult: + ) -> _models._models.RejectResult: ... @distributed_trace - def _reject_cloud_events( + def _reject_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, - reject_options: Union[_models.RejectOptions, JSON, IO[bytes]], + reject_options: Union[_models._models.RejectOptions, JSON, IO[bytes]], **kwargs: Any - ) -> _models.RejectResult: + ) -> _models._models.RejectResult: """Reject batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully rejected lockTokens, along with other failed lockTokens with their corresponding error information. @@ -1095,7 +1095,7 @@ def _reject_cloud_events( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop('content_type', _headers.pop('Content-Type', None)) - cls: ClsType[_models.RejectResult] = kwargs.pop( + cls: ClsType[_models._models.RejectResult] = kwargs.pop( # pylint: disable=protected-access 'cls', None ) @@ -1139,7 +1139,7 @@ def _reject_cloud_events( deserialized = response.iter_bytes() else: deserialized = _deserialize( - _models.RejectResult, + _models._models.RejectResult, # pylint: disable=protected-access response.json() ) @@ -1153,22 +1153,22 @@ def _reject_cloud_events( @overload @api_version_validation( method_added_on="2023-10-01-preview", - ) - def _renew_cloud_event_locks( + ) # pylint: disable=protected-access + def _renew_cloud_event_locks( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, - renew_lock_options: _models.RenewLockOptions, + renew_lock_options: _models._models.RenewLockOptions, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RenewCloudEventLocksResult: + ) -> _models._models.RenewCloudEventLocksResult: ... @overload @api_version_validation( method_added_on="2023-10-01-preview", - ) - def _renew_cloud_event_locks( + ) # pylint: disable=protected-access + def _renew_cloud_event_locks( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, @@ -1176,13 +1176,13 @@ def _renew_cloud_event_locks( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RenewCloudEventLocksResult: + ) -> _models._models.RenewCloudEventLocksResult: ... @overload @api_version_validation( method_added_on="2023-10-01-preview", - ) - def _renew_cloud_event_locks( + ) # pylint: disable=protected-access + def _renew_cloud_event_locks( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, @@ -1190,20 +1190,20 @@ def _renew_cloud_event_locks( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RenewCloudEventLocksResult: + ) -> _models._models.RenewCloudEventLocksResult: ... @distributed_trace @api_version_validation( method_added_on="2023-10-01-preview", - ) - def _renew_cloud_event_locks( + ) # pylint: disable=protected-access + def _renew_cloud_event_locks( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, - renew_lock_options: Union[_models.RenewLockOptions, JSON, IO[bytes]], + renew_lock_options: Union[_models._models.RenewLockOptions, JSON, IO[bytes]], **kwargs: Any - ) -> _models.RenewCloudEventLocksResult: + ) -> _models._models.RenewCloudEventLocksResult: """Renew lock for batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully renewed lockTokens, along with other failed lockTokens with their corresponding error @@ -1269,7 +1269,7 @@ def _renew_cloud_event_locks( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop('content_type', _headers.pop('Content-Type', None)) - cls: ClsType[_models.RenewCloudEventLocksResult] = kwargs.pop( + cls: ClsType[_models._models.RenewCloudEventLocksResult] = kwargs.pop( # pylint: disable=protected-access 'cls', None ) @@ -1313,7 +1313,7 @@ def _renew_cloud_event_locks( deserialized = response.iter_bytes() else: deserialized = _deserialize( - _models.RenewCloudEventLocksResult, + _models._models.RenewCloudEventLocksResult, # pylint: disable=protected-access response.json() ) diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/_patch.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/_patch.py index 784868d61bde..663fdc5e2532 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/_patch.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_operations/_patch.py @@ -40,6 +40,8 @@ from ..models._patch import ( ReceiveResult, ReceiveDetails, + Options, + Result ) from .. import models as _models from .._validation import api_version_validation @@ -448,9 +450,9 @@ def acknowledge_cloud_events( self, topic_name: str, subscription_name: str, - options: Union[_models.AcknowledgeOptions, JSON, IO], + options: Union[Options, JSON, IO], **kwargs: Any, - ) -> _models.AcknowledgeResult: + ) -> Result: """Acknowledge batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully acknowledged lockTokens, along with other failed lockTokens with their corresponding error @@ -460,11 +462,11 @@ def acknowledge_cloud_events( :type topic_name: str :param subscription_name: Event Subscription Name. Required. :type subscription_name: str - :param options: AcknowledgeOptions. Is one of the following types: - AcknowledgeOptions, JSON, IO[bytes] Required. - :type options: ~azure.eventgrid.models.AcknowledgeOptions or JSON or IO[bytes] - :return: AcknowledgeResult. The AcknowledgeResult is compatible with MutableMapping - :rtype: ~azure.eventgrid.models.AcknowledgeResult + :param options: Options. Is one of the following types: + Options, JSON, IO[bytes] Required. + :type options: ~azure.eventgrid.models.Options or JSON or IO[bytes] + :return: Result. The Result is compatible with MutableMapping + :rtype: ~azure.eventgrid.models.Result :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -522,11 +524,11 @@ def release_cloud_events( self, topic_name: str, subscription_name: str, - options: Union[_models.ReleaseOptions, JSON, IO], + options: Union[Options, JSON, IO], *, release_delay_in_seconds: Optional[Union[int, _models.ReleaseDelay]] = None, **kwargs: Any, - ) -> _models.ReleaseResult: + ) ->Result: """Release batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully released lockTokens, along with other failed lockTokens with their corresponding error information. @@ -535,14 +537,14 @@ def release_cloud_events( :type topic_name: str :param subscription_name: Event Subscription Name. Required. :type subscription_name: str - :param options: ReleaseOptions. Is one of the following types: ReleaseOptions, JSON, + :param options: Options. Is one of the following types: Options, JSON, IO[bytes] Required. - :type options: ~azure.eventgrid.models.ReleaseOptions or JSON or IO[bytes] + :type options: ~azure.eventgrid.models.Options 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 - :return: ReleaseResult. The ReleaseResult is compatible with MutableMapping - :rtype: ~azure.eventgrid.models.ReleaseResult + :return: Result. The Result is compatible with MutableMapping + :rtype: ~azure.eventgrid.models.Result :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -598,9 +600,9 @@ def reject_cloud_events( self, topic_name: str, subscription_name: str, - options: Union[_models.RejectOptions, JSON, IO], + options: Union[Options, JSON, IO], **kwargs: Any, - ) -> _models.RejectResult: + ) -> Result: """Reject batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully rejected lockTokens, along with other failed lockTokens with their corresponding error information. @@ -609,11 +611,11 @@ def reject_cloud_events( :type topic_name: str :param subscription_name: Event Subscription Name. Required. :type subscription_name: str - :param options: RejectOptions. Is one of the following types: RejectOptions, JSON, + :param options: Options. Is one of the following types: Options, JSON, IO[bytes] Required. - :type options: ~azure.eventgrid.models.RejectOptions or JSON or IO[bytes] - :return: RejectResult. The RejectResult is compatible with MutableMapping - :rtype: ~azure.eventgrid.models.RejectResult + :type options: ~azure.eventgrid.models.Options or JSON or IO[bytes] + :return: Result. The Result is compatible with MutableMapping + :rtype: ~azure.eventgrid.models.Result :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -671,9 +673,9 @@ def renew_cloud_event_locks( self, topic_name: str, subscription_name: str, - options: Union[_models.RenewLockOptions, JSON, IO], + options: Union[Options, JSON, IO], **kwargs: Any, - ) -> _models.RenewCloudEventLocksResult: + ) -> Result: """Renew lock for batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully renewed lockTokens, along with other failed lockTokens with their corresponding error @@ -683,12 +685,12 @@ def renew_cloud_event_locks( :type topic_name: str :param subscription_name: Event Subscription Name. Required. :type subscription_name: str - :param options: RenewLockOptions. Is one of the following types: RenewLockOptions, + :param options: Options. Is one of the following types: Options, JSON, IO[bytes] Required. - :type options: ~azure.eventgrid.models.RenewLockOptions or JSON or IO[bytes] - :return: RenewCloudEventLocksResult. The RenewCloudEventLocksResult is compatible with + :type options: ~azure.eventgrid.models.Options or JSON or IO[bytes] + :return: Result. The Result is compatible with MutableMapping - :rtype: ~azure.eventgrid.models.RenewCloudEventLocksResult + :rtype: ~azure.eventgrid.models.Result :raises ~azure.core.exceptions.HttpResponseError: Example: 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 c7fc082c3246..6417e4c8d6f8 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/_operations.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/_operations.py @@ -378,18 +378,18 @@ async def _receive_cloud_events( # pylint: disable=protected-access @overload - async def _acknowledge_cloud_events( + async def _acknowledge_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, - acknowledge_options: _models.AcknowledgeOptions, + acknowledge_options: _models._models.AcknowledgeOptions, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AcknowledgeResult: + ) -> _models._models.AcknowledgeResult: ... @overload - async def _acknowledge_cloud_events( + async def _acknowledge_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, @@ -397,10 +397,10 @@ async def _acknowledge_cloud_events( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AcknowledgeResult: + ) -> _models._models.AcknowledgeResult: ... @overload - async def _acknowledge_cloud_events( + async def _acknowledge_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, @@ -408,17 +408,17 @@ async def _acknowledge_cloud_events( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.AcknowledgeResult: + ) -> _models._models.AcknowledgeResult: ... @distributed_trace_async - async def _acknowledge_cloud_events( + async def _acknowledge_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, - acknowledge_options: Union[_models.AcknowledgeOptions, JSON, IO[bytes]], + acknowledge_options: Union[_models._models.AcknowledgeOptions, JSON, IO[bytes]], **kwargs: Any - ) -> _models.AcknowledgeResult: + ) -> _models._models.AcknowledgeResult: """Acknowledge batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully acknowledged lockTokens, along with other failed lockTokens with their corresponding error @@ -483,7 +483,7 @@ async def _acknowledge_cloud_events( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop('content_type', _headers.pop('Content-Type', None)) - cls: ClsType[_models.AcknowledgeResult] = kwargs.pop( + cls: ClsType[_models._models.AcknowledgeResult] = kwargs.pop( # pylint: disable=protected-access 'cls', None ) @@ -527,7 +527,7 @@ async def _acknowledge_cloud_events( deserialized = response.iter_bytes() else: deserialized = _deserialize( - _models.AcknowledgeResult, + _models._models.AcknowledgeResult, # pylint: disable=protected-access response.json() ) @@ -541,23 +541,23 @@ 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( + ) # pylint: disable=protected-access + async def _release_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, - release_options: _models.ReleaseOptions, + release_options: _models._models.ReleaseOptions, *, release_delay_in_seconds: Optional[Union[int, _models.ReleaseDelay]] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.ReleaseResult: + ) -> _models._models.ReleaseResult: ... @overload @api_version_validation( params_added_on={'2023-10-01-preview': ['release_delay_in_seconds']}, - ) - async def _release_cloud_events( + ) # pylint: disable=protected-access + async def _release_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, @@ -566,13 +566,13 @@ async def _release_cloud_events( release_delay_in_seconds: Optional[Union[int, _models.ReleaseDelay]] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.ReleaseResult: + ) -> _models._models.ReleaseResult: ... @overload @api_version_validation( params_added_on={'2023-10-01-preview': ['release_delay_in_seconds']}, - ) - async def _release_cloud_events( + ) # pylint: disable=protected-access + async def _release_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, @@ -581,22 +581,22 @@ async def _release_cloud_events( release_delay_in_seconds: Optional[Union[int, _models.ReleaseDelay]] = None, content_type: str = "application/json", **kwargs: Any - ) -> _models.ReleaseResult: + ) -> _models._models.ReleaseResult: ... @distributed_trace_async @api_version_validation( params_added_on={'2023-10-01-preview': ['release_delay_in_seconds']}, - ) - async def _release_cloud_events( + ) # pylint: disable=protected-access + async def _release_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, - release_options: Union[_models.ReleaseOptions, JSON, IO[bytes]], + release_options: Union[_models._models.ReleaseOptions, JSON, IO[bytes]], *, release_delay_in_seconds: Optional[Union[int, _models.ReleaseDelay]] = None, **kwargs: Any - ) -> _models.ReleaseResult: + ) -> _models._models.ReleaseResult: """Release batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully released lockTokens, along with other failed lockTokens with their corresponding error information. @@ -663,7 +663,7 @@ async def _release_cloud_events( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop('content_type', _headers.pop('Content-Type', None)) - cls: ClsType[_models.ReleaseResult] = kwargs.pop( + cls: ClsType[_models._models.ReleaseResult] = kwargs.pop( # pylint: disable=protected-access 'cls', None ) @@ -708,7 +708,7 @@ async def _release_cloud_events( deserialized = response.iter_bytes() else: deserialized = _deserialize( - _models.ReleaseResult, + _models._models.ReleaseResult, # pylint: disable=protected-access response.json() ) @@ -720,18 +720,18 @@ async def _release_cloud_events( @overload - async def _reject_cloud_events( + async def _reject_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, - reject_options: _models.RejectOptions, + reject_options: _models._models.RejectOptions, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RejectResult: + ) -> _models._models.RejectResult: ... @overload - async def _reject_cloud_events( + async def _reject_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, @@ -739,10 +739,10 @@ async def _reject_cloud_events( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RejectResult: + ) -> _models._models.RejectResult: ... @overload - async def _reject_cloud_events( + async def _reject_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, @@ -750,17 +750,17 @@ async def _reject_cloud_events( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RejectResult: + ) -> _models._models.RejectResult: ... @distributed_trace_async - async def _reject_cloud_events( + async def _reject_cloud_events( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, - reject_options: Union[_models.RejectOptions, JSON, IO[bytes]], + reject_options: Union[_models._models.RejectOptions, JSON, IO[bytes]], **kwargs: Any - ) -> _models.RejectResult: + ) -> _models._models.RejectResult: """Reject batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully rejected lockTokens, along with other failed lockTokens with their corresponding error information. @@ -824,7 +824,7 @@ async def _reject_cloud_events( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop('content_type', _headers.pop('Content-Type', None)) - cls: ClsType[_models.RejectResult] = kwargs.pop( + cls: ClsType[_models._models.RejectResult] = kwargs.pop( # pylint: disable=protected-access 'cls', None ) @@ -868,7 +868,7 @@ async def _reject_cloud_events( deserialized = response.iter_bytes() else: deserialized = _deserialize( - _models.RejectResult, + _models._models.RejectResult, # pylint: disable=protected-access response.json() ) @@ -882,22 +882,22 @@ async def _reject_cloud_events( @overload @api_version_validation( method_added_on="2023-10-01-preview", - ) - async def _renew_cloud_event_locks( + ) # pylint: disable=protected-access + async def _renew_cloud_event_locks( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, - renew_lock_options: _models.RenewLockOptions, + renew_lock_options: _models._models.RenewLockOptions, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RenewCloudEventLocksResult: + ) -> _models._models.RenewCloudEventLocksResult: ... @overload @api_version_validation( method_added_on="2023-10-01-preview", - ) - async def _renew_cloud_event_locks( + ) # pylint: disable=protected-access + async def _renew_cloud_event_locks( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, @@ -905,13 +905,13 @@ async def _renew_cloud_event_locks( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RenewCloudEventLocksResult: + ) -> _models._models.RenewCloudEventLocksResult: ... @overload @api_version_validation( method_added_on="2023-10-01-preview", - ) - async def _renew_cloud_event_locks( + ) # pylint: disable=protected-access + async def _renew_cloud_event_locks( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, @@ -919,20 +919,20 @@ async def _renew_cloud_event_locks( *, content_type: str = "application/json", **kwargs: Any - ) -> _models.RenewCloudEventLocksResult: + ) -> _models._models.RenewCloudEventLocksResult: ... @distributed_trace_async @api_version_validation( method_added_on="2023-10-01-preview", - ) - async def _renew_cloud_event_locks( + ) # pylint: disable=protected-access + async def _renew_cloud_event_locks( # pylint: disable=protected-access self, topic_name: str, event_subscription_name: str, - renew_lock_options: Union[_models.RenewLockOptions, JSON, IO[bytes]], + renew_lock_options: Union[_models._models.RenewLockOptions, JSON, IO[bytes]], **kwargs: Any - ) -> _models.RenewCloudEventLocksResult: + ) -> _models._models.RenewCloudEventLocksResult: """Renew lock for batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully renewed lockTokens, along with other failed lockTokens with their corresponding error @@ -998,7 +998,7 @@ async def _renew_cloud_event_locks( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop('content_type', _headers.pop('Content-Type', None)) - cls: ClsType[_models.RenewCloudEventLocksResult] = kwargs.pop( + cls: ClsType[_models._models.RenewCloudEventLocksResult] = kwargs.pop( # pylint: disable=protected-access 'cls', None ) @@ -1042,7 +1042,7 @@ async def _renew_cloud_event_locks( deserialized = response.iter_bytes() else: deserialized = _deserialize( - _models.RenewCloudEventLocksResult, + _models._models.RenewCloudEventLocksResult, # pylint: disable=protected-access response.json() ) diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/_patch.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/_patch.py index 3df30f4fba1f..015df1ce37a6 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/_patch.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/aio/_operations/_patch.py @@ -20,7 +20,7 @@ from azure.core.pipeline import PipelineResponse from azure.core.rest import HttpRequest, AsyncHttpResponse from azure.core.utils import case_insensitive_dict -from ...models._patch import ReceiveResult, ReceiveDetails +from ...models._patch import ReceiveResult, ReceiveDetails, Options, Result from ..._operations._patch import _to_http_request, use_standard_only from ._operations import EventGridClientOperationsMixin as OperationsMixin from ... import models as _models @@ -275,9 +275,9 @@ async def acknowledge_cloud_events( self, topic_name: str, subscription_name: str, - options: Union[_models.AcknowledgeOptions, JSON, IO], + options: Union[Options, JSON, IO], **kwargs: Any, - ) -> _models.AcknowledgeResult: + ) -> Result: """Acknowledge batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully acknowledged lockTokens, along with other failed lockTokens with their corresponding error @@ -287,11 +287,11 @@ async def acknowledge_cloud_events( :type topic_name: str :param subscription_name: Event Subscription Name. Required. :type subscription_name: str - :param options: AcknowledgeOptions. Is one of the following types: - AcknowledgeOptions, JSON, IO[bytes] Required. - :type options: ~azure.eventgrid.models.AcknowledgeOptions or JSON or IO[bytes] - :return: AcknowledgeResult. The AcknowledgeResult is compatible with MutableMapping - :rtype: ~azure.eventgrid.models.AcknowledgeResult + :param options: Options. Is one of the following types: + Options, JSON, IO[bytes] Required. + :type options: ~azure.eventgrid.models.Options or JSON or IO[bytes] + :return: Result. The Result is compatible with MutableMapping + :rtype: ~azure.eventgrid.models.Result :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -347,11 +347,11 @@ async def release_cloud_events( self, topic_name: str, subscription_name: str, - options: Union[_models.ReleaseOptions, JSON, IO], + options: Union[Options, JSON, IO], *, release_delay_in_seconds: Optional[Union[int, _models.ReleaseDelay]] = None, **kwargs: Any, - ) -> _models.ReleaseResult: + ) -> Result: """Release batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully released lockTokens, along with other failed lockTokens with their corresponding error information. @@ -360,14 +360,14 @@ async def release_cloud_events( :type topic_name: str :param subscription_name: Event Subscription Name. Required. :type subscription_name: str - :param options: ReleaseOptions. Is one of the following types: ReleaseOptions, JSON, + :param options: Options. Is one of the following types: Options, JSON, IO[bytes] Required. - :type options: ~azure.eventgrid.models.ReleaseOptions or JSON or IO[bytes] + :type options: ~azure.eventgrid.models.Options 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 - :return: ReleaseResult. The ReleaseResult is compatible with MutableMapping - :rtype: ~azure.eventgrid.models.ReleaseResult + :return: Result. The Result is compatible with MutableMapping + :rtype: ~azure.eventgrid.models.Result :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -424,9 +424,9 @@ async def reject_cloud_events( self, topic_name: str, subscription_name: str, - options: Union[_models.RejectOptions, JSON, IO], + options: Union[Options, JSON, IO], **kwargs: Any, - ) -> _models.RejectResult: + ) -> Result: """Reject batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully rejected lockTokens, along with other failed lockTokens with their corresponding error information. @@ -435,11 +435,11 @@ async def reject_cloud_events( :type topic_name: str :param subscription_name: Event Subscription Name. Required. :type subscription_name: str - :param options: RejectOptions. Is one of the following types: RejectOptions, JSON, + :param options: Options. Is one of the following types: Options, JSON, IO[bytes] Required. - :type options: ~azure.eventgrid.models.RejectOptions or JSON or IO[bytes] - :return: RejectResult. The RejectResult is compatible with MutableMapping - :rtype: ~azure.eventgrid.models.RejectResult + :type options: ~azure.eventgrid.models.Options or JSON or IO[bytes] + :return: Result. The Result is compatible with MutableMapping + :rtype: ~azure.eventgrid.models.Result :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -495,9 +495,9 @@ async def renew_cloud_event_locks( self, topic_name: str, subscription_name: str, - options: Union[_models.RenewLockOptions, JSON, IO], + options: Union[Options, JSON, IO], **kwargs: Any, - ) -> _models.RenewCloudEventLocksResult: + ) -> Result: """Renew lock for batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully accepted. The response body will include the set of successfully renewed lockTokens, along with other failed lockTokens with their corresponding error @@ -507,12 +507,12 @@ async def renew_cloud_event_locks( :type topic_name: str :param subscription_name: Event Subscription Name. Required. :type subscription_name: str - :param options: RenewLockOptions. Is one of the following types: RenewLockOptions, + :param options: Options. Is one of the following types: Options, JSON, IO[bytes] Required. - :type roptions: ~azure.eventgrid.models.RenewLockOptions or JSON or IO[bytes] - :return: RenewCloudEventLocksResult. The RenewCloudEventLocksResult is compatible with + :type options: ~azure.eventgrid.models.Options or JSON or IO[bytes] + :return: Result. The Result is compatible with MutableMapping - :rtype: ~azure.eventgrid.models.RenewCloudEventLocksResult + :rtype: ~azure.eventgrid.models.Result :raises ~azure.core.exceptions.HttpResponseError: Example: diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/__init__.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/__init__.py index 5076d94735a5..c273ca50d44e 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/__init__.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/__init__.py @@ -6,30 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._models import AcknowledgeOptions -from ._models import AcknowledgeResult from ._models import FailedLockToken -from ._models import RejectOptions -from ._models import RejectResult -from ._models import ReleaseOptions -from ._models import ReleaseResult -from ._models import RenewCloudEventLocksResult -from ._models import RenewLockOptions from ._enums import ReleaseDelay from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - 'AcknowledgeOptions', - 'AcknowledgeResult', 'FailedLockToken', - 'RejectOptions', - 'RejectResult', - 'ReleaseOptions', - 'ReleaseResult', - 'RenewCloudEventLocksResult', - 'RenewLockOptions', 'ReleaseDelay', ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/_models.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/_models.py index 97626fee728e..7fc316be9867 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/_models.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/_models.py @@ -31,24 +31,6 @@ class AcknowledgeOptions(_model_base.Model): """Array of lock tokens. Required.""" - @overload - def __init__( - self, - *, - lock_tokens: List[str], - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None:# pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - @@ -73,25 +55,6 @@ class AcknowledgeResult(_model_base.Model): """Array of lock tokens for the successfully acknowledged cloud events. Required.""" - @overload - def __init__( - self, - *, - failed_lock_tokens: List["_models.FailedLockToken"], - succeeded_lock_tokens: List[str], - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None:# pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - @@ -326,24 +289,6 @@ class RejectOptions(_model_base.Model): """Array of lock tokens. Required.""" - @overload - def __init__( - self, - *, - lock_tokens: List[str], - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None:# pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - @@ -368,25 +313,6 @@ class RejectResult(_model_base.Model): """Array of lock tokens for the successfully rejected cloud events. Required.""" - @overload - def __init__( - self, - *, - failed_lock_tokens: List["_models.FailedLockToken"], - succeeded_lock_tokens: List[str], - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None:# pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - @@ -403,24 +329,6 @@ class ReleaseOptions(_model_base.Model): """Array of lock tokens. Required.""" - @overload - def __init__( - self, - *, - lock_tokens: List[str], - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None:# pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - @@ -445,25 +353,6 @@ class ReleaseResult(_model_base.Model): """Array of lock tokens for the successfully released cloud events. Required.""" - @overload - def __init__( - self, - *, - failed_lock_tokens: List["_models.FailedLockToken"], - succeeded_lock_tokens: List[str], - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None:# pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - @@ -487,25 +376,6 @@ class RenewCloudEventLocksResult(_model_base.Model): """Array of lock tokens for the successfully renewed locks. Required.""" - @overload - def __init__( - self, - *, - failed_lock_tokens: List["_models.FailedLockToken"], - succeeded_lock_tokens: List[str], - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None:# pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - @@ -522,22 +392,4 @@ class RenewLockOptions(_model_base.Model): """Array of lock tokens. Required.""" - @overload - def __init__( - self, - *, - lock_tokens: List[str], - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type 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/azure/eventgrid/models/_patch.py b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/_patch.py index ee8fa6387b70..1a65e71efbff 100644 --- a/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/_patch.py +++ b/sdk/eventgrid/azure-eventgrid/azure/eventgrid/models/_patch.py @@ -12,6 +12,9 @@ ReceiveDetails as InternalReceiveDetails, ReceiveResult as InternalReceiveResult, BrokerProperties as InternalBrokerProperties, + AcknowledgeOptions as InternalAcknowledgeOptions, + AcknowledgeResult as InternalAcknowledgeResult, + FailedLockToken, ) @@ -107,11 +110,59 @@ def __init__( # pylint: disable=useless-super-delegation ) -> None: super().__init__(*args, **kwargs) +class Result(InternalAcknowledgeResult): + """Details of the operation response. + + All required parameters must be populated in order to send to server. + + :ivar failed_lock_tokens: Array of FailedLockToken for failed cloud events. Each + FailedLockToken includes the lock token along with the related error information (namely, the + error code and description). Required. + :vartype failed_lock_tokens: list[~azure.eventgrid.models.FailedLockToken] + :ivar succeeded_lock_tokens: Array of lock tokens for the successfully renewed locks. Required. + :vartype succeeded_lock_tokens: list[str] + """ + + @overload + def __init__( + self, + *, + failed_lock_tokens: List["FailedLockToken"], + succeeded_lock_tokens: List[str], + ): ... + + def __init__( # pylint: disable=useless-super-delegation + self, *args: Any, **kwargs: Any + ) -> None: + super().__init__(*args, **kwargs) + +class Options(InternalAcknowledgeOptions): + """Array of lock tokens for the corresponding received Cloud Events. + + All required parameters must be populated in order to send to server. + + :ivar lock_tokens: Array of lock tokens. Required. + :vartype lock_tokens: list[str] + """ + + @overload + def __init__( + self, + *, + lock_tokens: List[str], + ): ... + + def __init__( # pylint: disable=useless-super-delegation + self, *args: Any, **kwargs: Any + ) -> None: + super().__init__(*args, **kwargs) __all__: List[str] = [ "ReceiveDetails", "ReceiveResult", "BrokerProperties", + "Options", + "Result", ] # Add all objects you want publicly available to users at this package level diff --git a/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_acknowledge_operation_async.py b/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_acknowledge_operation_async.py index 4d9486b19348..295c20784f4f 100644 --- a/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_acknowledge_operation_async.py +++ b/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_acknowledge_operation_async.py @@ -36,7 +36,7 @@ async def run(): # Acknowledge a batch of CloudEvents try: async with client: - lock_tokens = AcknowledgeOptions(lock_tokens=["token"]) + lock_tokens = Options(lock_tokens=["token"]) ack_events = await client.acknowledge_cloud_events( topic_name=TOPIC_NAME, subscription_name=EVENT_SUBSCRIPTION_NAME, diff --git a/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_all_operations_async.py b/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_all_operations_async.py index 8fcc63f1d1c6..ba5360baa773 100644 --- a/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_all_operations_async.py +++ b/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_all_operations_async.py @@ -95,7 +95,7 @@ async def run(): if len(release_events) > 0: try: - release_tokens = ReleaseOptions(lock_tokens=release_events) + release_tokens = Options(lock_tokens=release_events) release_result = await client.release_cloud_events( topic_name=TOPIC_NAME, subscription_name=EVENT_SUBSCRIPTION_NAME, @@ -109,7 +109,7 @@ async def run(): if len(acknowledge_events) > 0: try: - ack_tokens = AcknowledgeOptions(lock_tokens=acknowledge_events) + ack_tokens = Options(lock_tokens=acknowledge_events) ack_result = await client.acknowledge_cloud_events( topic_name=TOPIC_NAME, subscription_name=EVENT_SUBSCRIPTION_NAME, @@ -123,7 +123,7 @@ async def run(): if len(reject_events) > 0: try: - reject_tokens = RejectOptions(lock_tokens=reject_events) + reject_tokens = Options(lock_tokens=reject_events) reject_result = await client.reject_cloud_events( topic_name=TOPIC_NAME, subscription_name=EVENT_SUBSCRIPTION_NAME, diff --git a/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_publish_receive_renew_async.py b/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_publish_receive_renew_async.py index 919aec3bb484..01fe59010ca3 100644 --- a/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_publish_receive_renew_async.py +++ b/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_publish_receive_renew_async.py @@ -48,7 +48,7 @@ async def run(): lock_tokens_to_release.append(item.broker_properties.lock_token) # Renew lock tokens - lock_tokens = RenewLockOptions(lock_tokens=lock_tokens_to_release) + lock_tokens = Options(lock_tokens=lock_tokens_to_release) renew_events = await client.renew_cloud_event_locks( topic_name=TOPIC_NAME, subscription_name=EVENT_SUBSCRIPTION_NAME, diff --git a/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_publish_release_receive_async.py b/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_publish_release_receive_async.py index 92e715e202d8..fa4520e8aef2 100644 --- a/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_publish_release_receive_async.py +++ b/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_publish_release_receive_async.py @@ -50,7 +50,7 @@ async def run(): print("Received events:", receive_result.value) # Release a LockToken - release_token = ReleaseOptions(lock_tokens=lock_tokens_to_release) + release_token = Options(lock_tokens=lock_tokens_to_release) release_events = await client.release_cloud_events( topic_name=TOPIC_NAME, subscription_name=EVENT_SUBSCRIPTION_NAME, @@ -64,7 +64,7 @@ async def run(): print("Received events after release:", receive_result.value) # Acknowledge LockTokens - acknowledge_token = AcknowledgeOptions(lock_tokens=lock_tokens_to_release) + acknowledge_token = Options(lock_tokens=lock_tokens_to_release) acknowledge_events = await client.acknowledge_cloud_events( topic_name=TOPIC_NAME, subscription_name=EVENT_SUBSCRIPTION_NAME, diff --git a/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_reject_operation_async.py b/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_reject_operation_async.py index fe42f210d3cb..7a9667747399 100644 --- a/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_reject_operation_async.py +++ b/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_reject_operation_async.py @@ -36,7 +36,7 @@ async def run(): # Reject a LockToken try: async with client: - tokens = RejectOptions(lock_tokens=["token"]) + tokens = Options(lock_tokens=["token"]) reject_events = await client.reject_cloud_events( topic_name=TOPIC_NAME, subscription_name=EVENT_SUBSCRIPTION_NAME, diff --git a/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_release_operation_async.py b/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_release_operation_async.py index c26faaf12cc0..b998a1640cdf 100644 --- a/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_release_operation_async.py +++ b/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_release_operation_async.py @@ -36,7 +36,7 @@ async def run(): # Release a LockToken try: async with client: - tokens = ReleaseOptions(lock_tokens=["token"]) + tokens = Options(lock_tokens=["token"]) release_events = await client.release_cloud_events( topic_name=TOPIC_NAME, subscription_name=EVENT_SUBSCRIPTION_NAME, diff --git a/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_renew_locks_operation_async.py b/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_renew_locks_operation_async.py index abbb22ddaadd..a907f7a3f778 100644 --- a/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_renew_locks_operation_async.py +++ b/sdk/eventgrid/azure-eventgrid/samples/async_samples/eventgrid_client_samples/sample_renew_locks_operation_async.py @@ -34,7 +34,7 @@ async def run(): # Renew a lockToken try: - lock_tokens = RenewLockOptions(lock_tokens=["token"]) + lock_tokens = Options(lock_tokens=["token"]) release_events = await client.renew_cloud_event_locks( topic_name=TOPIC_NAME, subscription_name=EVENT_SUBSCRIPTION_NAME, diff --git a/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_acknowledge_operation.py b/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_acknowledge_operation.py index c92be24f01ef..3f8bf7cc6f74 100644 --- a/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_acknowledge_operation.py +++ b/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_acknowledge_operation.py @@ -33,7 +33,7 @@ # Acknowledge a CloudEvent try: - lock_tokens = AcknowledgeOptions(lock_tokens=["token"]) + lock_tokens = Options(lock_tokens=["token"]) ack_events = client.acknowledge_cloud_events( topic_name=TOPIC_NAME, subscription_name=EVENT_SUBSCRIPTION_NAME, diff --git a/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_all_operations.py b/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_all_operations.py index 00e6d9e90cdc..cbd2d807e38e 100644 --- a/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_all_operations.py +++ b/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_all_operations.py @@ -88,7 +88,7 @@ if len(release_events) > 0: try: - release_tokens = ReleaseOptions(lock_tokens=release_events) + release_tokens = Options(lock_tokens=release_events) release_result = client.release_cloud_events( topic_name=TOPIC_NAME, subscription_name=EVENT_SUBSCRIPTION_NAME, @@ -102,7 +102,7 @@ if len(acknowledge_events) > 0: try: - ack_tokens = AcknowledgeOptions(lock_tokens=acknowledge_events) + ack_tokens = Options(lock_tokens=acknowledge_events) ack_result = client.acknowledge_cloud_events( topic_name=TOPIC_NAME, subscription_name=EVENT_SUBSCRIPTION_NAME, @@ -116,7 +116,7 @@ if len(reject_events) > 0: try: - reject_tokens = RejectOptions(lock_tokens=reject_events) + reject_tokens = Options(lock_tokens=reject_events) reject_result = client.reject_cloud_events( topic_name=TOPIC_NAME, subscription_name=EVENT_SUBSCRIPTION_NAME, diff --git a/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_publish_receive_renew.py b/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_publish_receive_renew.py index 20bc88e7c63b..e239fd52276e 100644 --- a/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_publish_receive_renew.py +++ b/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_publish_receive_renew.py @@ -45,7 +45,7 @@ lock_tokens_to_release.append(item.broker_properties.lock_token) # Renew a lock token - lock_tokens = RenewLockOptions(lock_tokens=lock_tokens_to_release) + lock_tokens = Options(lock_tokens=lock_tokens_to_release) renew_events = client.renew_cloud_event_locks( topic_name=TOPIC_NAME, subscription_name=EVENT_SUBSCRIPTION_NAME, diff --git a/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_publish_release_receive.py b/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_publish_release_receive.py index e1f05fcdd003..33cddacec553 100644 --- a/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_publish_release_receive.py +++ b/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_publish_release_receive.py @@ -47,7 +47,7 @@ print("Received events:", receive_result.value) # Release a LockToken - release_token = ReleaseOptions(lock_tokens=lock_tokens_to_release) + release_token = Options(lock_tokens=lock_tokens_to_release) release_events = client.release_cloud_events( topic_name=TOPIC_NAME, subscription_name=EVENT_SUBSCRIPTION_NAME, @@ -61,7 +61,7 @@ print("Received events after release:", receive_result.value) # Acknowledge a LockToken - acknowledge_token = AcknowledgeOptions(lock_tokens=lock_tokens_to_release) + acknowledge_token = Options(lock_tokens=lock_tokens_to_release) acknowledge_events = client.acknowledge_cloud_events( topic_name=TOPIC_NAME, subscription_name=EVENT_SUBSCRIPTION_NAME, diff --git a/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_reject_operation.py b/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_reject_operation.py index 71a6ae3263d5..e1672b6fc0cc 100644 --- a/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_reject_operation.py +++ b/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_reject_operation.py @@ -32,7 +32,7 @@ # Release a LockToken try: - lock_tokens = RejectOptions(lock_tokens=["token"]) + lock_tokens = Options(lock_tokens=["token"]) reject_events = client.reject_cloud_events( topic_name=TOPIC_NAME, subscription_name=EVENT_SUBSCRIPTION_NAME, diff --git a/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_release_operation.py b/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_release_operation.py index b17948361dea..8e5215bbb392 100644 --- a/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_release_operation.py +++ b/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_release_operation.py @@ -32,7 +32,7 @@ # Release a LockToken try: - lock_tokens = ReleaseOptions(lock_tokens=["token"]) + lock_tokens = Options(lock_tokens=["token"]) release_events = client.release_cloud_events( topic_name=TOPIC_NAME, subscription_name=EVENT_SUBSCRIPTION_NAME, diff --git a/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_renew_locks_operation.py b/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_renew_locks_operation.py index 1646267ff9aa..1e66a3a639c5 100644 --- a/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_renew_locks_operation.py +++ b/sdk/eventgrid/azure-eventgrid/samples/sync_samples/eventgrid_client_samples/sample_renew_locks_operation.py @@ -32,7 +32,7 @@ # Renew a lockToken try: - lock_tokens = RenewLockOptions(lock_tokens=["token"]) + lock_tokens = Options(lock_tokens=["token"]) release_events = client.renew_cloud_event_locks( topic_name=TOPIC_NAME, subscription_name=EVENT_SUBSCRIPTION_NAME, diff --git a/sdk/eventgrid/azure-eventgrid/tests/test_eg_client.py b/sdk/eventgrid/azure-eventgrid/tests/test_eg_client.py index 0982f23b134b..ffd3f57bc602 100644 --- a/sdk/eventgrid/azure-eventgrid/tests/test_eg_client.py +++ b/sdk/eventgrid/azure-eventgrid/tests/test_eg_client.py @@ -175,7 +175,7 @@ def test_publish_receive_cloud_event(self, eventgrid_endpoint, eventgrid_key, ev events = client.receive_cloud_events(eventgrid_topic_name, eventgrid_event_subscription_name,max_events=1) lock_token = events.value[0].broker_properties.lock_token - ack = client.acknowledge_cloud_events(eventgrid_topic_name, eventgrid_event_subscription_name, acknowledge_options=AcknowledgeOptions(lock_tokens=[lock_token])) + ack = client.acknowledge_cloud_events(eventgrid_topic_name, eventgrid_event_subscription_name, acknowledge_options=Options(lock_tokens=[lock_token])) assert len(ack.succeeded_lock_tokens) == 1 assert len(ack.failed_lock_tokens) == 0 diff --git a/sdk/eventgrid/azure-eventgrid/tests/test_eg_client_exceptions.py b/sdk/eventgrid/azure-eventgrid/tests/test_eg_client_exceptions.py index 5a9b51cbb5b1..a15ba49ead92 100644 --- a/sdk/eventgrid/azure-eventgrid/tests/test_eg_client_exceptions.py +++ b/sdk/eventgrid/azure-eventgrid/tests/test_eg_client_exceptions.py @@ -105,7 +105,7 @@ def test_acknowledge_cloud_event_not_found(self, eventgrid_endpoint, eventgrid_k client = self.create_eg_client(eventgrid_endpoint, eventgrid_key) with pytest.raises(ResourceNotFoundError): - lock_tokens = AcknowledgeOptions(lock_tokens=["faketoken"]) + lock_tokens = Options(lock_tokens=["faketoken"]) client.acknowledge_cloud_events( "faketopic", eventgrid_event_subscription_name, lock_tokens ) @@ -116,7 +116,7 @@ def test_release_cloud_event_not_found(self, eventgrid_endpoint, eventgrid_key, client = self.create_eg_client(eventgrid_endpoint, eventgrid_key) with pytest.raises(ResourceNotFoundError): - lock_tokens = ReleaseOptions(lock_tokens=["faketoken"]) + lock_tokens = Options(lock_tokens=["faketoken"]) client.release_cloud_events( "faketopic", eventgrid_event_subscription_name, lock_tokens ) @@ -125,7 +125,7 @@ def test_release_cloud_event_not_found(self, eventgrid_endpoint, eventgrid_key, @recorded_by_proxy def test_reject_cloud_event_not_found(self, eventgrid_endpoint, eventgrid_key, eventgrid_event_subscription_name): client = self.create_eg_client(eventgrid_endpoint, eventgrid_key) - lock_tokens = RejectOptions(lock_tokens=["faketoken"]) + lock_tokens = Options(lock_tokens=["faketoken"]) with pytest.raises(ResourceNotFoundError): client.reject_cloud_events( @@ -137,11 +137,11 @@ def test_reject_cloud_event_not_found(self, eventgrid_endpoint, eventgrid_key, e def test_acknowledge_cloud_event_invalid_token(self, eventgrid_endpoint, eventgrid_key, eventgrid_topic_name, eventgrid_event_subscription_name): client = self.create_eg_client(eventgrid_endpoint, eventgrid_key) - lock_tokens = AcknowledgeOptions(lock_tokens=["faketoken"]) + lock_tokens = Options(lock_tokens=["faketoken"]) ack = client.acknowledge_cloud_events( eventgrid_topic_name, eventgrid_event_subscription_name, lock_tokens ) - assert type(ack) == AcknowledgeResult + assert type(ack) == Result assert ack.succeeded_lock_tokens == [] assert type(ack.failed_lock_tokens[0]) == FailedLockToken assert ack.failed_lock_tokens[0].lock_token == "faketoken" @@ -151,11 +151,11 @@ def test_acknowledge_cloud_event_invalid_token(self, eventgrid_endpoint, eventgr def test_release_cloud_event_invalid_token(self, eventgrid_endpoint, eventgrid_key, eventgrid_topic_name, eventgrid_event_subscription_name): client = self.create_eg_client(eventgrid_endpoint, eventgrid_key) - lock_tokens = ReleaseOptions(lock_tokens=["faketoken"]) + lock_tokens = Options(lock_tokens=["faketoken"]) release = client.release_cloud_events( eventgrid_topic_name, eventgrid_event_subscription_name, lock_tokens ) - assert type(release) == ReleaseResult + assert type(release) == Result assert release.succeeded_lock_tokens == [] assert type(release.failed_lock_tokens[0]) == FailedLockToken assert release.failed_lock_tokens[0].lock_token == "faketoken" @@ -164,12 +164,12 @@ def test_release_cloud_event_invalid_token(self, eventgrid_endpoint, eventgrid_k @recorded_by_proxy def test_reject_cloud_event_invalid_token(self, eventgrid_endpoint, eventgrid_key, eventgrid_topic_name, eventgrid_event_subscription_name): client = self.create_eg_client(eventgrid_endpoint, eventgrid_key) - lock_tokens = RejectOptions(lock_tokens=["faketoken"]) + lock_tokens = Options(lock_tokens=["faketoken"]) reject = client.reject_cloud_events( eventgrid_topic_name, eventgrid_event_subscription_name, lock_tokens ) - assert type(reject) == RejectResult + assert type(reject) == Result assert reject.succeeded_lock_tokens == [] assert type(reject.failed_lock_tokens[0]) == FailedLockToken assert reject.failed_lock_tokens[0].lock_token == "faketoken"